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

Method test_fileobj_no_close

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

Source from the content-addressed store, hash-verified

1388 # in all possible mode combinations.
1389
1390 def test_fileobj_no_close(self):
1391 fobj = io.BytesIO()
1392 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
1393 tar.addfile(tarfile.TarInfo("foo"))
1394 self.assertFalse(fobj.closed, "external fileobjs must never closed")
1395 # Issue #20238: Incomplete gzip output with mode="w:gz"
1396 data = fobj.getvalue()
1397 del tar
1398 support.gc_collect()
1399 self.assertFalse(fobj.closed)
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).

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