summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-18 11:20:36 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-18 11:20:36 (GMT)
commit6a5fc4c443fb7190f3f68ed1eaa799b71fa36124 (patch)
tree750a39715372ea241831a0e19d5be4a4a6fe3bd6 /Lib/test/test_zipfile.py
parenta69be2803b25c226a439152ec680d7ee6f5e57f6 (diff)
downloadcpython-6a5fc4c443fb7190f3f68ed1eaa799b71fa36124.zip
cpython-6a5fc4c443fb7190f3f68ed1eaa799b71fa36124.tar.gz
cpython-6a5fc4c443fb7190f3f68ed1eaa799b71fa36124.tar.bz2
#14313: zipfile now raises NotImplementedError when the compression type is unknown.
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r--Lib/test/test_zipfile.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 51d8b45..5bc03b5 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -922,6 +922,17 @@ class OtherTests(unittest.TestCase):
caught."""
self.assertRaises(RuntimeError, zipfile.ZipFile, TESTFN, "w", -1)
+ def test_unsupported_compression(self):
+ # data is declared as shrunk, but actually deflated
+ data = (b'PK\x03\x04.\x00\x00\x00\x01\x00\xe4C\xa1@\x00\x00\x00'
+ b'\x00\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00x\x03\x00PK\x01'
+ b'\x02.\x03.\x00\x00\x00\x01\x00\xe4C\xa1@\x00\x00\x00\x00\x02\x00\x00'
+ b'\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+ b'\x80\x01\x00\x00\x00\x00xPK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00'
+ b'/\x00\x00\x00!\x00\x00\x00\x00\x00')
+ with zipfile.ZipFile(io.BytesIO(data), 'r') as zipf:
+ self.assertRaises(NotImplementedError, zipf.open, 'x')
+
def test_null_byte_in_filename(self):
"""Check that a filename containing a null byte is properly
terminated."""