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

Method test_popitem

Lib/test/test_mailbox.py:453–467  ·  view source on GitHub ↗
(self, iterations=10)

Source from the content-addressed store, hash-verified

451 self.assertEqual(len(self._box), 0)
452
453 def test_popitem(self, iterations=10):
454 # Get and remove an arbitrary (key, message) using popitem()
455 keys = []
456 for i in range(10):
457 keys.append(self._box.add(self._template % i))
458 seen = []
459 for i in range(10):
460 key, msg = self._box.popitem()
461 self.assertIn(key, keys)
462 self.assertNotIn(key, seen)
463 seen.append(key)
464 self.assertEqual(int(msg.get_payload()), keys.index(key))
465 self.assertEqual(len(self._box), 0)
466 for key in keys:
467 self.assertRaises(KeyError, lambda: self._box[key])
468
469 def test_update(self):
470 # Modify multiple messages using update()

Callers

nothing calls this directly

Calls 9

assertInMethod · 0.80
assertNotInMethod · 0.80
get_payloadMethod · 0.80
appendMethod · 0.45
addMethod · 0.45
popitemMethod · 0.45
assertEqualMethod · 0.45
indexMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected