(self, method, should_call_close)
| 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 |
no test coverage detected