summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r--Lib/test/test_zipfile.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index ac9a4ff..3b78b7f 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -549,6 +549,22 @@ class StoredTestsWithSourceFile(AbstractTestsWithSourceFile,
with zipfile.ZipFile(TESTFN2, "w") as zipfp:
self.assertRaises(ValueError, zipfp.write, TESTFN)
+ with zipfile.ZipFile(TESTFN2, "w") as zipfp:
+ zipfp.write(TESTFN, strict_timestamps=False)
+ zinfo = zipfp.getinfo(TESTFN)
+ self.assertEqual(zinfo.date_time, (1980, 1, 1, 0, 0, 0))
+
+ def test_add_file_after_2107(self):
+ # Set atime and mtime to 2108-12-30
+ os.utime(TESTFN, (4386268800, 4386268800))
+ with zipfile.ZipFile(TESTFN2, "w") as zipfp:
+ self.assertRaises(struct.error, zipfp.write, TESTFN)
+
+ with zipfile.ZipFile(TESTFN2, "w") as zipfp:
+ zipfp.write(TESTFN, strict_timestamps=False)
+ zinfo = zipfp.getinfo(TESTFN)
+ self.assertEqual(zinfo.date_time, (2107, 12, 31, 23, 59, 59))
+
@requires_zlib
class DeflateTestsWithSourceFile(AbstractTestsWithSourceFile,