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

Method test_clear

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

Source from the content-addressed store, hash-verified

421 self.assertEqual(len(self._box), 2)
422
423 def test_clear(self, iterations=10):
424 # Remove all messages using clear()
425 keys = []
426 for i in range(iterations):
427 self._box.add(self._template % i)
428 for i, key in enumerate(keys):
429 self.assertEqual(self._box.get_string(key), self._template % i)
430 self._box.clear()
431 self.assertEqual(len(self._box), 0)
432 for i, key in enumerate(keys):
433 self.assertRaises(KeyError, lambda: self._box.get_string(key))
434
435 def test_pop(self):
436 # Get and remove a message using pop()

Callers

nothing calls this directly

Calls 6

enumerateFunction · 0.85
addMethod · 0.45
assertEqualMethod · 0.45
get_stringMethod · 0.45
clearMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected