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

Method test_empty_tarfile

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

Source from the content-addressed store, hash-verified

441 self.assertEqual(file_like.tell(), 0)
442
443 def test_empty_tarfile(self):
444 # Test for issue6123: Allow opening empty archives.
445 # This test checks if tarfile.open() is able to open an empty tar
446 # archive successfully. Note that an empty tar archive is not the
447 # same as an empty file!
448 with tarfile.open(tmpname, self.mode.replace("r", "w")):
449 pass
450 try:
451 tar = tarfile.open(tmpname, self.mode)
452 tar.getnames()
453 except tarfile.ReadError:
454 self.fail("tarfile.open() failed on empty archive")
455 else:
456 self.assertListEqual(tar.getmembers(), [])
457 finally:
458 tar.close()
459
460 def test_non_existent_tarfile(self):
461 # Test for issue11513: prevent non-existent gzipped tarfiles raising

Callers

nothing calls this directly

Calls 7

getnamesMethod · 0.80
assertListEqualMethod · 0.80
getmembersMethod · 0.80
openMethod · 0.45
replaceMethod · 0.45
failMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected