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