(self)
| 412 | self.assertFalse(tarfile.is_tarfile(io.BytesIO(b"invalid"))) |
| 413 | |
| 414 | def test_is_tarfile_valid(self): |
| 415 | # is_tarfile works on filenames |
| 416 | self.assertTrue(tarfile.is_tarfile(self.tarname)) |
| 417 | |
| 418 | # is_tarfile works on path-like objects |
| 419 | self.assertTrue(tarfile.is_tarfile(os_helper.FakePath(self.tarname))) |
| 420 | |
| 421 | # is_tarfile works on file objects |
| 422 | with open(self.tarname, "rb") as fobj: |
| 423 | self.assertTrue(tarfile.is_tarfile(fobj)) |
| 424 | |
| 425 | # is_tarfile works on file-like objects |
| 426 | with open(self.tarname, "rb") as fobj: |
| 427 | self.assertTrue(tarfile.is_tarfile(io.BytesIO(fobj.read()))) |
| 428 | |
| 429 | def test_is_tarfile_keeps_position(self): |
| 430 | # Test for issue44289: tarfile.is_tarfile() modifies |
nothing calls this directly
no test coverage detected