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

Method test_add_and_close

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

Source from the content-addressed store, hash-verified

1199 self.assertEqual(mtime, os.path.getmtime(self._path))
1200
1201 def test_add_and_close(self):
1202 # Verifying that closing a mailbox doesn't change added items
1203 self._box.add(_sample_message)
1204 for i in range(3):
1205 self._box.add(self._template % i)
1206 self._box.add(_sample_message)
1207 self._box._file.flush()
1208 self._box._file.seek(0)
1209 contents = self._box._file.read()
1210 self._box.close()
1211 with open(self._path, 'rb') as f:
1212 self.assertEqual(contents, f.read())
1213 self._box = self._factory(self._path)
1214
1215 @support.requires_fork()
1216 @unittest.skipUnless(hasattr(socket, 'socketpair'), "Test needs socketpair().")

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