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

Method test_splittable_setdefault

Lib/test/test_dict.py:982–995  ·  view source on GitHub ↗

split table must keep correct insertion order when attributes are adding using setdefault()

(self)

Source from the content-addressed store, hash-verified

980
981 @support.cpython_only
982 def test_splittable_setdefault(self):
983 """split table must keep correct insertion
984 order when attributes are adding using setdefault()"""
985 a, b = self.make_shared_key_dict(2)
986
987 a['a'] = 1
988 size_a = sys.getsizeof(a)
989 a['b'] = 2
990 b.setdefault('b', 2)
991 size_b = sys.getsizeof(b)
992 b['a'] = 1
993
994 self.assertEqual(list(a), ['x', 'y', 'z', 'a', 'b'])
995 self.assertEqual(list(b), ['x', 'y', 'z', 'b', 'a'])
996
997 @support.cpython_only
998 def test_splittable_del(self):

Callers

nothing calls this directly

Calls 4

make_shared_key_dictMethod · 0.95
listClass · 0.85
setdefaultMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected