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

Method test_ordering

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

Source from the content-addressed store, hash-verified

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