(self)
| 1045 | |
| 1046 | class Bz2DetectReadTest(Bz2Test, DetectReadTest): |
| 1047 | def test_detect_stream_bz2(self): |
| 1048 | # Originally, tarfile's stream detection looked for the string |
| 1049 | # "BZh91" at the start of the file. This is incorrect because |
| 1050 | # the '9' represents the blocksize (900,000 bytes). If the file was |
| 1051 | # compressed using another blocksize autodetection fails. |
| 1052 | with open(tarname, "rb") as fobj: |
| 1053 | data = fobj.read() |
| 1054 | |
| 1055 | # Compress with blocksize 100,000 bytes, the file starts with "BZh11". |
| 1056 | with bz2.BZ2File(tmpname, "wb", compresslevel=1) as fobj: |
| 1057 | fobj.write(data) |
| 1058 | |
| 1059 | self._testfunc_file(tmpname, "r|*") |
| 1060 | |
| 1061 | class LzmaDetectReadTest(LzmaTest, DetectReadTest): |
| 1062 | pass |
nothing calls this directly
no test coverage detected