diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2012-05-01 12:08:22 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2012-05-01 12:08:22 (GMT) |
commit | d099b56be77c782b969ccf5912ab01a3b313c759 (patch) | |
tree | 4ed4ca1fc9dd9a3c30d731c02243f91e1c420778 /Lib/test/test_zipfile.py | |
parent | 67c14444545a7a9882665679672f0ddeac9cf635 (diff) | |
download | cpython-d099b56be77c782b969ccf5912ab01a3b313c759.zip cpython-d099b56be77c782b969ccf5912ab01a3b313c759.tar.gz cpython-d099b56be77c782b969ccf5912ab01a3b313c759.tar.bz2 |
Check extract_version when opening a zipfile.
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r-- | Lib/test/test_zipfile.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index dcf8f74..80d45f5 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -828,6 +828,16 @@ class OtherTests(unittest.TestCase): b'\x00\x00\x00\x00'), } + def test_unsupported_version(self): + # File has an extract_version of 120 + data = (b'PK\x03\x04x\x00\x00\x00\x00\x00!p\xa1@\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00xPK\x01\x02x\x03x\x00\x00\x00\x00' + b'\x00!p\xa1@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00' + b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x01\x00\x00\x00\x00xPK\x05\x06' + b'\x00\x00\x00\x00\x01\x00\x01\x00/\x00\x00\x00\x1f\x00\x00\x00\x00\x00') + self.assertRaises(NotImplementedError, zipfile.ZipFile, + io.BytesIO(data), 'r') + def test_unicode_filenames(self): with zipfile.ZipFile(TESTFN, "w") as zf: zf.writestr("foo.txt", "Test for unicode filename") |