diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_bz2.py | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | Lib/test/test_gzip.py | 13 |
2 files changed, 0 insertions, 31 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py index bcf80dc4a5..93f71fe6aa 100644 --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -292,24 +292,6 @@ class BZ2FileTest(BaseTest): self.assertRaises(ValueError, f.readline) self.assertRaises(ValueError, f.readlines) - def test_read_truncated(self): - # Drop the eos_magic field (6 bytes) and CRC (4 bytes). - truncated = self.DATA[:-10] - with open(self.filename, 'wb') as f: - f.write(truncated) - with BZ2File(self.filename) as f: - self.assertRaises(EOFError, f.read) - with BZ2File(self.filename) as f: - self.assertEqual(f.read(len(self.TEXT)), self.TEXT) - self.assertRaises(EOFError, f.read, 1) - # Incomplete 4-byte file header, and block header of at least 146 bits. - for i in range(22): - with open(self.filename, 'wb') as f: - f.write(truncated[:i]) - with BZ2File(self.filename) as f: - self.assertRaises(EOFError, f.read, 1) - - class BZ2CompressorTest(BaseTest): def testCompress(self): # "Test BZ2Compressor.compress()/flush()" diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index b912576bcc..a4dfac4138 100644..100755 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -365,19 +365,6 @@ class TestGzip(unittest.TestCase): datac = gzip.compress(data) self.assertEqual(gzip.decompress(datac), data) - def test_read_truncated(self): - data = data1*50 - # Drop the CRC (4 bytes) and file size (4 bytes). - truncated = gzip.compress(data)[:-8] - with gzip.GzipFile(fileobj=io.BytesIO(truncated)) as f: - self.assertRaises(EOFError, f.read) - with gzip.GzipFile(fileobj=io.BytesIO(truncated)) as f: - self.assertEqual(f.read(len(data)), data) - self.assertRaises(EOFError, f.read, 1) - # Incomplete 10-byte header. - for i in range(2, 10): - with gzip.GzipFile(fileobj=io.BytesIO(truncated[:i])) as f: - self.assertRaises(EOFError, f.read, 1) def test_read_with_extra(self): # Gzip data with an extra field |