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

Method test_clear

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected