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

Method test_fileobj_no_close

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

Source from the content-addressed store, hash-verified

1405 # in all possible mode combinations.
1406
1407 def test_fileobj_no_close(self):
1408 fobj = io.BytesIO()
1409 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
1410 tar.addfile(tarfile.TarInfo("foo"))
1411 self.assertFalse(fobj.closed, "external fileobjs must never closed")
1412 # Issue #20238: Incomplete gzip output with mode="w:gz"
1413 data = fobj.getvalue()
1414 del tar
1415 support.gc_collect()
1416 self.assertFalse(fobj.closed)
1417 self.assertEqual(data, fobj.getvalue())
1418
1419 def test_eof_marker(self):
1420 # Make sure an end of archive marker is written (two zero blocks).

Callers

nothing calls this directly

Calls 5

getvalueMethod · 0.95
addfileMethod · 0.80
assertFalseMethod · 0.80
openMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected