diff options
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/test/regrtest.py | 2 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 72d103974a..b6aa96b327 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -710,7 +710,7 @@ def dash_R_cleanup(fs, ps, pic, abcs): sys.path_importer_cache.update(pic) # clear type cache - sys._cleartypecache() + sys._clear_type_cache() # Clear ABC registries, restoring previously saved ABC registries. for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]: diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index aafbfa3756..a01ea3e9b4 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -363,6 +363,24 @@ class SysModuleTest(unittest.TestCase): self.assertEqual(type(getattr(sys.flags, attr)), int, attr) self.assert_(repr(sys.flags)) + def test_clear_type_cache(self): + sys._clear_type_cache() + + def test_compact_freelists(self): + sys._compact_freelists() + r = sys._compact_freelists() + # freed blocks shouldn't change + self.assertEqual(r[0][2], 0) + self.assertEqual(r[1][2], 0) + # fill freelists + ints = list(range(12000)) + floats = [float(i) for i in ints] + del ints + del floats + # should free more than 200 blocks each + r = sys._compact_freelists() + self.assert_(r[0][2] > 200, r[0][2]) + self.assert_(r[1][2] > 200, r[1][2]) def test_main(): test.test_support.run_unittest(SysModuleTest) |