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

Method test_popitem

Lib/test/test_ordered_dict.py:233–242  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

231 self.assertEqual(list(reversed(od.items())), empty)
232
233 def test_popitem(self):
234 OrderedDict = self.OrderedDict
235 pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
236 shuffle(pairs)
237 od = OrderedDict(pairs)
238 while pairs:
239 self.assertEqual(od.popitem(), pairs.pop())
240 with self.assertRaises(KeyError):
241 od.popitem()
242 self.assertEqual(len(od), 0)
243
244 def test_popitem_last(self):
245 OrderedDict = self.OrderedDict

Callers

nothing calls this directly

Calls 5

popitemMethod · 0.95
OrderedDictClass · 0.70
assertEqualMethod · 0.45
popMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected