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

Method test_ordering

Lib/test/test_collections.py:150–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

148 self.assertEqual(f.parents['b'], 2) # look beyond maps[0]
149
150 def test_ordering(self):
151 # Combined order matches a series of dict updates from last to first.
152 # This test relies on the ordering of the underlying dicts.
153
154 baseline = {'music': 'bach', 'art': 'rembrandt'}
155 adjustments = {'art': 'van gogh', 'opera': 'carmen'}
156
157 cm = ChainMap(adjustments, baseline)
158
159 combined = baseline.copy()
160 combined.update(adjustments)
161
162 self.assertEqual(list(combined.items()), list(cm.items()))
163
164 def test_constructor(self):
165 self.assertEqual(ChainMap().maps, [{}]) # no-args --> one new dict

Callers

nothing calls this directly

Calls 6

ChainMapClass · 0.90
listClass · 0.85
copyMethod · 0.45
updateMethod · 0.45
assertEqualMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected