MCPcopy Index your code
hub / github.com/python/cpython / test_splittable_del

Method test_splittable_del

Lib/test/test_dict.py:998–1014  ·  view source on GitHub ↗

split table must be combined when del d[k]

(self)

Source from the content-addressed store, hash-verified

996
997 @support.cpython_only
998 def test_splittable_del(self):
999 """split table must be combined when del d[k]"""
1000 a, b = self.make_shared_key_dict(2)
1001
1002 orig_size = sys.getsizeof(a)
1003
1004 del a['y'] # split table is combined
1005 with self.assertRaises(KeyError):
1006 del a['y']
1007
1008 self.assertEqual(list(a), ['x', 'z'])
1009 self.assertEqual(list(b), ['x', 'y', 'z'])
1010
1011 # Two dicts have different insertion order.
1012 a['y'] = 42
1013 self.assertEqual(list(a), ['x', 'z', 'y'])
1014 self.assertEqual(list(b), ['x', 'y', 'z'])
1015
1016 @support.cpython_only
1017 def test_splittable_pop(self):

Callers

nothing calls this directly

Calls 4

make_shared_key_dictMethod · 0.95
listClass · 0.85
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected