MCPcopy Index your code
hub / github.com/python/cpython / testMoreThan64kFiles

Method testMoreThan64kFiles

Lib/test/test_zipfile64.py:91–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

89
90class OtherTests(unittest.TestCase):
91 def testMoreThan64kFiles(self):
92 # This test checks that more than 64k files can be added to an archive,
93 # and that the resulting archive can be read properly by ZipFile
94 with zipfile.ZipFile(TESTFN, mode="w", allowZip64=True) as zipf:
95 zipf.debug = 100
96 numfiles = (1 << 16) * 3//2
97 for i in range(numfiles):
98 zipf.writestr("foo%08d" % i, "%d" % (i**3 % 57))
99 self.assertEqual(len(zipf.namelist()), numfiles)
100
101 with zipfile.ZipFile(TESTFN, mode="r") as zipf2:
102 self.assertEqual(len(zipf2.namelist()), numfiles)
103 for i in range(numfiles):
104 content = zipf2.read("foo%08d" % i).decode('ascii')
105 self.assertEqual(content, "%d" % (i**3 % 57))
106
107 def testMoreThan64kFilesAppend(self):
108 with zipfile.ZipFile(TESTFN, mode="w", allowZip64=False) as zipf:

Callers

nothing calls this directly

Calls 5

writestrMethod · 0.80
assertEqualMethod · 0.45
namelistMethod · 0.45
decodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected