diff options
author | Mark Shannon <mark@hotpy.org> | 2021-10-06 12:19:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 12:19:53 (GMT) |
commit | a7252f88d3fa33036bdd6036b8c97bc785ed6f17 (patch) | |
tree | 525655111a4423af0de21004ab1c3f6d7e765fe6 /Lib/test/test_dict.py | |
parent | f6eafe18c004c55082de40d20cad084ef9dd3db7 (diff) | |
download | cpython-a7252f88d3fa33036bdd6036b8c97bc785ed6f17.zip cpython-a7252f88d3fa33036bdd6036b8c97bc785ed6f17.tar.gz cpython-a7252f88d3fa33036bdd6036b8c97bc785ed6f17.tar.bz2 |
bpo-40116: Add insertion order bit-vector to dict values to allow dicts to share keys more freely. (GH-28520)
Diffstat (limited to 'Lib/test/test_dict.py')
-rw-r--r-- | Lib/test/test_dict.py | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 666cd81..a6ce6f9 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1020,7 +1020,6 @@ class DictTest(unittest.TestCase): with self.assertRaises(KeyError): del a['y'] - self.assertGreater(sys.getsizeof(a), orig_size) self.assertEqual(list(a), ['x', 'z']) self.assertEqual(list(b), ['x', 'y', 'z']) @@ -1031,16 +1030,12 @@ class DictTest(unittest.TestCase): @support.cpython_only def test_splittable_pop(self): - """split table must be combined when d.pop(k)""" a, b = self.make_shared_key_dict(2) - orig_size = sys.getsizeof(a) - - a.pop('y') # split table is combined + a.pop('y') with self.assertRaises(KeyError): a.pop('y') - self.assertGreater(sys.getsizeof(a), orig_size) self.assertEqual(list(a), ['x', 'z']) self.assertEqual(list(b), ['x', 'y', 'z']) @@ -1074,36 +1069,6 @@ class DictTest(unittest.TestCase): self.assertEqual(list(a), ['x', 'y']) self.assertEqual(list(b), ['x', 'y', 'z']) - @support.cpython_only - def test_splittable_setattr_after_pop(self): - """setattr() must not convert combined table into split table.""" - # Issue 28147 - import _testcapi - - class C: - pass - a = C() - - a.a = 1 - self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) - - # dict.pop() convert it to combined table - a.__dict__.pop('a') - self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) - - # But C should not convert a.__dict__ to split table again. - a.a = 1 - self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) - - # Same for popitem() - a = C() - a.a = 2 - self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) - a.__dict__.popitem() - self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) - a.a = 3 - self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) - def test_iterator_pickling(self): for proto in range(pickle.HIGHEST_PROTOCOL + 1): data = {1:"a", 2:"b", 3:"c"} |