summaryrefslogtreecommitdiff
path: root/Lib/test/test_gzip.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-01-13 14:32:10 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-01-13 14:32:10 +0000
commit5a9112c0cc33614c284c18a6f622a32c97b7ae3d (patch)
tree99f33d8df4116a351e721dd0abfc10f07b9e6330 /Lib/test/test_gzip.py
parent10042922d9dbb25c6e8b63698c34b6f3943a8cf1 (diff)
downloadcpython-git-5a9112c0cc33614c284c18a6f622a32c97b7ae3d.tar.gz
Issue #2846: Add support for gzip.GzipFile reading zero-padded files.
Patch by Brian Curtin.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r--Lib/test/test_gzip.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 60094dceb1..b6901343eb 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -252,6 +252,18 @@ class TestGzip(unittest.TestCase):
else:
self.fail("1/0 didn't raise an exception")
+ def test_zero_padded_file(self):
+ with gzip.GzipFile(self.filename, "wb") as f:
+ f.write(data1 * 50)
+
+ # Pad the file with zeroes
+ with open(self.filename, "ab") as f:
+ f.write("\x00" * 50)
+
+ with gzip.GzipFile(self.filename, "rb") as f:
+ d = f.read()
+ self.assertEqual(d, data1 * 50, "Incorrect data in file")
+
def test_main(verbose=None):
test_support.run_unittest(TestGzip)