diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-07-03 14:13:42 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-07-03 14:13:42 (GMT) |
commit | b09b844a5c7bb41cf67af8aafe0682c3bfdc12da (patch) | |
tree | 09cb453d31b46761a3da71b09ec4927fdaf61373 /Lib/test/test_zipfile64.py | |
parent | 451a356f11d3ed498a359f94d85a7df5d6a2a843 (diff) | |
download | cpython-b09b844a5c7bb41cf67af8aafe0682c3bfdc12da.zip cpython-b09b844a5c7bb41cf67af8aafe0682c3bfdc12da.tar.gz cpython-b09b844a5c7bb41cf67af8aafe0682c3bfdc12da.tar.bz2 |
Merged revisions 64688 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64688 | martin.v.loewis | 2008-07-03 14:51:14 +0200 (Do, 03 Jul 2008) | 9 lines
Patch #1622: Correct interpretation of various ZIP header fields.
Also fixes
- Issue #1526: Allow more than 64k files to be added to Zip64 file.
- Issue #1746: Correct handling of zipfile archive comments (previously
archives with comments over 4k were flagged as invalid). Allow writing
Zip files with archives by setting the 'comment' attribute of a ZipFile.
........
Diffstat (limited to 'Lib/test/test_zipfile64.py')
-rw-r--r-- | Lib/test/test_zipfile64.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py index 343fd4f..ead0be2 100644 --- a/Lib/test/test_zipfile64.py +++ b/Lib/test/test_zipfile64.py @@ -2,6 +2,7 @@ # The support.requires call is the only reason for keeping this separate # from test_zipfile from test import support + # XXX(nnorwitz): disable this test by looking for extra largfile resource # which doesn't exist. This test takes over 30 minutes to run in general # and requires more disk space than most of the buildbots. @@ -92,8 +93,31 @@ class TestsWithSourceFile(unittest.TestCase): if os.path.exists(fname): os.remove(fname) + +class OtherTests(unittest.TestCase): + def testMoreThan64kFiles(self): + # This test checks that more than 64k files can be added to an archive, + # and that the resulting archive can be read properly by ZipFile + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.debug = 100 + numfiles = (1 << 16) * 3/2 + for i in xrange(numfiles): + zipf.writestr("foo%08d" % i, "%d" % (i**3 % 57)) + self.assertEqual(len(zipf.namelist()), numfiles) + zipf.close() + + zipf2 = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(len(zipf2.namelist()), numfiles) + for i in xrange(numfiles): + self.assertEqual(zipf2.read("foo%08d" % i), "%d" % (i**3 % 57)) + zipf.close() + + def tearDown(self): + test_support.unlink(TESTFN) + test_support.unlink(TESTFN2) + def test_main(): - run_unittest(TestsWithSourceFile) + run_unittest(TestsWithSourceFile, OtherTests) if __name__ == "__main__": test_main() |