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

Method test_splittable_update

Lib/test/test_dict.py:1058–1072  ·  view source on GitHub ↗

dict.update(other) must preserve order in other.

(self)

Source from the content-addressed store, hash-verified

1056
1057 @support.cpython_only
1058 def test_splittable_update(self):
1059 """dict.update(other) must preserve order in other."""
1060 class C:
1061 def __init__(self, order):
1062 if order:
1063 self.a, self.b, self.c = 1, 2, 3
1064 else:
1065 self.c, self.b, self.a = 1, 2, 3
1066 o = C(True)
1067 o = C(False) # o.__dict__ has reversed order.
1068 self.assertEqual(list(o.__dict__), ["c", "b", "a"])
1069
1070 d = {}
1071 d.update(o.__dict__)
1072 self.assertEqual(list(d), ["c", "b", "a"])
1073
1074 @support.cpython_only
1075 def test_splittable_to_generic_combinedtable(self):

Callers

nothing calls this directly

Calls 4

listClass · 0.85
CClass · 0.70
assertEqualMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected