summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-02-07 20:24:02 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2010-02-07 20:24:02 (GMT)
commitee5c885fd2446dea7269c65248312a0856f50fd3 (patch)
tree2d2fdd42b64d0febbe419f35087e866c0ca0f5c9 /Lib/test
parent755740f3ea9c5005d16a80c07e7fc26e45f11aa1 (diff)
downloadcpython-ee5c885fd2446dea7269c65248312a0856f50fd3.zip
cpython-ee5c885fd2446dea7269c65248312a0856f50fd3.tar.gz
cpython-ee5c885fd2446dea7269c65248312a0856f50fd3.tar.bz2
Merged revisions 78097 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78097 | ronald.oussoren | 2010-02-07 21:18:02 +0100 (Sun, 07 Feb 2010) | 2 lines Issue 6003: ZipFile.writestr "compression_type" argument ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_zipfile.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index a925560..8e2cf55 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -407,6 +407,20 @@ class TestsWithSourceFile(unittest.TestCase):
# remove the test file subdirectories
shutil.rmtree(os.path.join(os.getcwd(), 'ziptest2dir'))
+ def test_writestr_compression(self):
+ zipfp = zipfile.ZipFile(TESTFN2, "w")
+ zipfp.writestr("a.txt", "hello world", compress_type=zipfile.ZIP_STORED)
+ if zlib:
+ zipfp.writestr("b.txt", "hello world", compress_type=zipfile.ZIP_DEFLATED)
+
+ info = zipfp.getinfo('a.txt')
+ self.assertEqual(info.compress_type, zipfile.ZIP_STORED)
+
+ if zlib:
+ info = zipfp.getinfo('b.txt')
+ self.assertEqual(info.compress_type, zipfile.ZIP_DEFLATED)
+
+
def zip_test_writestr_permissions(self, f, compression):
# Make sure that writestr creates files with mode 0600,
# when it is passed a name rather than a ZipInfo instance.