summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipimport.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_zipimport.py')
-rw-r--r--Lib/test/test_zipimport.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index 63e5672..e98b090 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -116,6 +116,9 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
zinfo = ZipInfo(name, time.localtime(mtime))
zinfo.compress_type = self.compression
z.writestr(zinfo, data)
+ comment = kw.get("comment", None)
+ if comment is not None:
+ z.comment = comment
stuff = kw.get("stuff", None)
if stuff is not None:
@@ -665,6 +668,18 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
with self.assertRaises(TypeError):
zipimport.zipimporter(memoryview(os.fsencode(filename)))
+ def testComment(self):
+ files = {TESTMOD + ".py": (NOW, test_src)}
+ self.doTest(".py", files, TESTMOD, comment=b"comment")
+
+ def testBeginningCruftAndComment(self):
+ files = {TESTMOD + ".py": (NOW, test_src)}
+ self.doTest(".py", files, TESTMOD, stuff=b"cruft" * 64, comment=b"hi")
+
+ def testLargestPossibleComment(self):
+ files = {TESTMOD + ".py": (NOW, test_src)}
+ self.doTest(".py", files, TESTMOD, comment=b"c" * ((1 << 16) - 1))
+
@support.requires_zlib
class CompressedZipImportTestCase(UncompressedZipImportTestCase):