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

Method test_order_preservation

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

Source from the content-addressed store, hash-verified

189 d.popitem()
190
191 def test_order_preservation(self):
192 d = ChainMap(
193 OrderedDict(j=0, h=88888),
194 OrderedDict(),
195 OrderedDict(i=9999, d=4444, c=3333),
196 OrderedDict(f=666, b=222, g=777, c=333, h=888),
197 OrderedDict(),
198 OrderedDict(e=55, b=22),
199 OrderedDict(a=1, b=2, c=3, d=4, e=5),
200 OrderedDict(),
201 )
202 self.assertEqual(''.join(d), 'abcdefghij')
203 self.assertEqual(list(d.items()),
204 [('a', 1), ('b', 222), ('c', 3333), ('d', 4444),
205 ('e', 55), ('f', 666), ('g', 777), ('h', 88888),
206 ('i', 9999), ('j', 0)])
207
208 def test_iter_not_calling_getitem_on_maps(self):
209 class DictWithGetItem(UserDict):

Callers

nothing calls this directly

Calls 6

ChainMapClass · 0.90
OrderedDictClass · 0.90
listClass · 0.85
assertEqualMethod · 0.45
joinMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected