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

Method _test_flush_or_close

Lib/test/test_mailbox.py:530–544  ·  view source on GitHub ↗
(self, method, should_call_close)

Source from the content-addressed store, hash-verified

528 self._test_flush_or_close(self._box.close, False)
529
530 def _test_flush_or_close(self, method, should_call_close):
531 contents = [self._template % i for i in range(3)]
532 self._box.add(contents[0])
533 self._box.add(contents[1])
534 self._box.add(contents[2])
535 oldbox = self._box
536 method()
537 if should_call_close:
538 self._box.close()
539 self._box = self._factory(self._path)
540 keys = self._box.keys()
541 self.assertEqual(len(keys), 3)
542 for key in keys:
543 self.assertIn(self._box.get_string(key), contents)
544 oldbox.close()
545
546 def test_use_context_manager(self):
547 # Mailboxes are usable as a context manager

Callers 2

test_flushMethod · 0.95
test_closeMethod · 0.95

Calls 8

methodFunction · 0.85
_factoryMethod · 0.80
assertInMethod · 0.80
addMethod · 0.45
closeMethod · 0.45
keysMethod · 0.45
assertEqualMethod · 0.45
get_stringMethod · 0.45

Tested by

no test coverage detected