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

Method test_eof_marker

Lib/test/test_tarfile.py:1402–1413  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1400 self.assertEqual(data, fobj.getvalue())
1401
1402 def test_eof_marker(self):
1403 # Make sure an end of archive marker is written (two zero blocks).
1404 # tarfile insists on aligning archives to a 20 * 512 byte recordsize.
1405 # So, we create an archive that has exactly 10240 bytes without the
1406 # marker, and has 20480 bytes once the marker is written.
1407 with tarfile.open(tmpname, self.mode) as tar:
1408 t = tarfile.TarInfo("foo")
1409 t.size = tarfile.RECORDSIZE - tarfile.BLOCKSIZE
1410 tar.addfile(t, io.BytesIO(b"a" * t.size))
1411
1412 with self.open(tmpname, "rb") as fobj:
1413 self.assertEqual(len(fobj.read()), tarfile.RECORDSIZE * 2)
1414
1415
1416class WriteTest(WriteTestBase, unittest.TestCase):

Callers

nothing calls this directly

Calls 5

lenFunction · 0.85
addfileMethod · 0.80
openMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected