summaryrefslogtreecommitdiff
path: root/Lib/test/test_gzip.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-04-08 22:35:02 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2013-04-08 22:35:02 +0300
commit7e69f0085e5365347bf00f4ed08d07e5f4785a96 (patch)
treeb028993963f97dd40a197d0de4e9568c86102c2a /Lib/test/test_gzip.py
parentb0f9fa7a03ed56c2155fb251fbd423637dc86536 (diff)
downloadcpython-git-7e69f0085e5365347bf00f4ed08d07e5f4785a96.tar.gz
Close #17666: Fix reading gzip files with an extra field.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r--Lib/test/test_gzip.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index ebd4c43855..37fe8538a7 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -403,6 +403,13 @@ class TestGzip(BaseTest):
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'
+ b'\x05\x00Extra'
+ b'\x0bI-.\x01\x002\xd1Mx\x04\x00\x00\x00')
+ with gzip.GzipFile(fileobj=io.BytesIO(gzdata)) as f:
+ self.assertEqual(f.read(), b'Test')
class TestOpen(BaseTest):
def test_binary_modes(self):