Issue #20875: Prevent possible gzip "'read' is not defined" NameError.

Patch by Claudiu Popa.
This commit is contained in:
Ned Deily 2014-03-09 14:44:34 -07:00
parent 5e572fd490
commit 6120739f0c
3 changed files with 11 additions and 1 deletions

View file

@ -396,6 +396,13 @@ class TestGzip(BaseTest):
with gzip.GzipFile(fileobj=io.BytesIO(gzdata)) as f:
self.assertEqual(f.read(), b'Test')
def test_prepend_error(self):
# See issue #20875
with gzip.open(self.filename, "wb") as f:
f.write(data1)
with gzip.open(self.filename, "rb") as f:
f.fileobj.prepend()
class TestOpen(BaseTest):
def test_binary_modes(self):
uncompressed = data1 * 50