Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_filecmp.py @ 84124:bfd53dcb02ff
Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache.
Patch by Mark Levitt
| author | Ned Deily <nad@acm.org> |
|---|---|
| date | Fri, 14 Jun 2013 15:19:11 -0700 |
| parents | a1efab48d8f8 |
| children |
line wrap: on
line diff
--- a/Lib/test/test_filecmp.py Fri Jun 14 15:04:26 2013 -0400 +++ b/Lib/test/test_filecmp.py Fri Jun 14 15:19:11 2013 -0700 @@ -39,6 +39,13 @@ self.assertFalse(filecmp.cmp(self.name, self.dir), "File and directory compare as equal") + def test_cache_clear(self): + first_compare = filecmp.cmp(self.name, self.name_same, shallow=False) + second_compare = filecmp.cmp(self.name, self.name_diff, shallow=False) + filecmp.clear_cache() + self.assertTrue(len(filecmp._cache) == 0, + "Cache not cleared after calling clear_cache") + class DirCompareTestCase(unittest.TestCase): def setUp(self): tmpdir = tempfile.gettempdir()
