MCPcopy Create free account
hub / github.com/python/cpython / test_add_and_close

Method test_add_and_close

Lib/test/test_mailbox.py:1215–1227  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1213 self.assertEqual(mtime, os.path.getmtime(self._path))
1214
1215 def test_add_and_close(self):
1216 # Verifying that closing a mailbox doesn't change added items
1217 self._box.add(_sample_message)
1218 for i in range(3):
1219 self._box.add(self._template % i)
1220 self._box.add(_sample_message)
1221 self._box._file.flush()
1222 self._box._file.seek(0)
1223 contents = self._box._file.read()
1224 self._box.close()
1225 with open(self._path, 'rb') as f:
1226 self.assertEqual(contents, f.read())
1227 self._box = self._factory(self._path)
1228
1229 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
1230 @support.requires_fork()

Callers

nothing calls this directly

Calls 8

_factoryMethod · 0.80
openFunction · 0.50
addMethod · 0.45
flushMethod · 0.45
seekMethod · 0.45
readMethod · 0.45
closeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected