mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Back out patch for #1159051, which caused backwards compatibility problems.
This commit is contained in:
parent
64949fa20e
commit
b3bd624a55
5 changed files with 44 additions and 82 deletions
14
Lib/test/test_gzip.py
Normal file → Executable file
14
Lib/test/test_gzip.py
Normal file → Executable file
|
|
@ -389,20 +389,6 @@ class TestGzip(BaseTest):
|
|||
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
|
||||
gzdata = (b'\x1f\x8b\x08\x04\xb2\x17cQ\x02\xff'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue