MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_splittable_del

Method test_splittable_del

Lib/test/test_dict.py:1001–1017  ·  view source on GitHub ↗

split table must be combined when del d[k]

(self)

Source from the content-addressed store, hash-verified

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