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

Method test_splittable_popitem

Lib/test/test_dict.py:1042–1055  ·  view source on GitHub ↗

split table must be combined when d.popitem()

(self)

Source from the content-addressed store, hash-verified

1040
1041 @support.cpython_only
1042 def test_splittable_popitem(self):
1043 """split table must be combined when d.popitem()"""
1044 a, b = self.make_shared_key_dict(2)
1045
1046 orig_size = sys.getsizeof(a)
1047
1048 item = a.popitem() # split table is combined
1049 self.assertEqual(item, ('z', 3))
1050 with self.assertRaises(KeyError):
1051 del a['z']
1052
1053 self.assertGreater(sys.getsizeof(a), orig_size)
1054 self.assertEqual(list(a), ['x', 'y'])
1055 self.assertEqual(list(b), ['x', 'y', 'z'])
1056
1057 @support.cpython_only
1058 def test_splittable_update(self):

Callers

nothing calls this directly

Calls 6

make_shared_key_dictMethod · 0.95
listClass · 0.85
assertGreaterMethod · 0.80
popitemMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected