summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-28 22:18:57 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-28 22:18:57 (GMT)
commitbc3478043d3f00d0b5e75d9b3e4b37351d5a0ff0 (patch)
treea45dc23d8cc06a145308760fcb2d079e23f1cbad /Lib/test/test_zipfile.py
parent06c3369e34ffaf12722f307c65dfb06605b2e67b (diff)
downloadcpython-bc3478043d3f00d0b5e75d9b3e4b37351d5a0ff0.zip
cpython-bc3478043d3f00d0b5e75d9b3e4b37351d5a0ff0.tar.gz
cpython-bc3478043d3f00d0b5e75d9b3e4b37351d5a0ff0.tar.bz2
Merged revisions 74245 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74245 | amaury.forgeotdarc | 2009-07-29 00:15:30 +0200 (mer., 29 juil. 2009) | 3 lines #6511: ZipFile will now raise BadZipfile when opening an empty or tiny file, like it does for larger invalid files. ........
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()