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

Method test_splittable_setdefault

Lib/test/test_dict.py:985–998  ·  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

983
984 @support.cpython_only
985 def test_splittable_setdefault(self):
986 """split table must keep correct insertion
987 order when attributes are adding using setdefault()"""
988 a, b = self.make_shared_key_dict(2)
989
990 a['a'] = 1
991 size_a = sys.getsizeof(a)
992 a['b'] = 2
993 b.setdefault('b', 2)
994 size_b = sys.getsizeof(b)
995 b['a'] = 1
996
997 self.assertEqual(list(a), ['x', 'y', 'z', 'a', 'b'])
998 self.assertEqual(list(b), ['x', 'y', 'z', 'b', 'a'])
999
1000 @support.cpython_only
1001 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