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.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 782020c..bb0d79a 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -507,6 +507,13 @@ class TestsWithSourceFile(unittest.TestCase):
except zipfile.BadZipFile:
self.assertTrue(zipfp2.fp is None, 'zipfp is not closed')
+ def test_add_file_before_1980(self):
+ # Set atime and mtime to 1970-01-01
+ os.utime(TESTFN, (0, 0))
+ with zipfile.ZipFile(TESTFN2, "w") as zipfp:
+ self.assertRaises(ValueError, zipfp.write, TESTFN)
+
+
@skipUnless(zlib, "requires zlib")
def test_unicode_filenames(self):
# bug #10801
@@ -1053,6 +1060,10 @@ class OtherTests(unittest.TestCase):
f.close()
self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN, 'r')
+ def test_create_zipinfo_before_1980(self):
+ self.assertRaises(ValueError,
+ zipfile.ZipInfo, 'seventies', (1979, 1, 1, 0, 0, 0))
+
def tearDown(self):
unlink(TESTFN)
unlink(TESTFN2)