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.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index d4bb4d2..b17f857 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -701,6 +701,16 @@ class OtherTests(unittest.TestCase):
# quickly.
self.assertRaises(IOError, zipfile.ZipFile, TESTFN)
+ def test_empty_file_raises_BadZipFile(self):
+ f = open(TESTFN, 'w')
+ f.close()
+ self.assertRaises(zipfile.BadZipfile, zipfile.ZipFile, TESTFN)
+
+ f = open(TESTFN, 'w')
+ f.write("short file")
+ f.close()
+ self.assertRaises(zipfile.BadZipfile, zipfile.ZipFile, TESTFN)
+
def test_closed_zip_raises_RuntimeError(self):
# Verify that testzip() doesn't swallow inappropriate exceptions.
data = io.BytesIO()