diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-11-12 01:57:36 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-11-12 01:57:36 (GMT) |
commit | 3be2f0454aa0d2e77e85eed36b8988f93d6361eb (patch) | |
tree | 6f1f21f8b692cb379f1ddda8be325904fe0f119d | |
parent | e25576467b37c78aac4b350b8f1561b64634e613 (diff) | |
download | cpython-3be2f0454aa0d2e77e85eed36b8988f93d6361eb.zip cpython-3be2f0454aa0d2e77e85eed36b8988f93d6361eb.tar.gz cpython-3be2f0454aa0d2e77e85eed36b8988f93d6361eb.tar.bz2 |
#2971: test_zipfile64 fails.
This test is always skipped, but it is not a reason not to adapt it to py3k.
I had to reduce most of the big figures to actually run the test.
-rw-r--r-- | Lib/test/test_zipfile64.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py index ead0be2..0e7d73f 100644 --- a/Lib/test/test_zipfile64.py +++ b/Lib/test/test_zipfile64.py @@ -35,7 +35,7 @@ class TestsWithSourceFile(unittest.TestCase): def setUp(self): # Create test data. line_gen = ("Test of zipfile line %d." % i for i in range(1000000)) - self.data = '\n'.join(line_gen) + self.data = '\n'.join(line_gen).encode('ascii') # And write it to a file. fp = open(TESTFN, "wb") @@ -100,21 +100,22 @@ class OtherTests(unittest.TestCase): # 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): + numfiles = (1 << 16) * 3//2 + for i in range(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)) + for i in range(numfiles): + content = zipf2.read("foo%08d" % i).decode('ascii') + self.assertEqual(content, "%d" % (i**3 % 57)) zipf.close() def tearDown(self): - test_support.unlink(TESTFN) - test_support.unlink(TESTFN2) + support.unlink(TESTFN) + support.unlink(TESTFN2) def test_main(): run_unittest(TestsWithSourceFile, OtherTests) |