summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-09-17 12:36:40 (GMT)
committerGitHub <noreply@github.com>2018-09-17 12:36:40 (GMT)
commit9bdb7be482aef8f60daa1d36606568a132dcb616 (patch)
tree4674ee096eb080080b2d0f435e7e6a9e1808f277 /Lib/test/test_zipfile.py
parentda8d72c953369b872a12c13f136ada77a786714a (diff)
downloadcpython-9bdb7be482aef8f60daa1d36606568a132dcb616.zip
cpython-9bdb7be482aef8f60daa1d36606568a132dcb616.tar.gz
cpython-9bdb7be482aef8f60daa1d36606568a132dcb616.tar.bz2
bpo-34341: Fix appending to ZIP archives with the ZIP64 extension. (GH-8683)
Diffstat (limited to 'Lib/test/test_zipfile.py')
-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 4c6f57c..7b8922f 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -770,6 +770,20 @@ class StoredTestZip64InSmallFiles(AbstractTestZip64InSmallFiles,
with zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) as zipfp:
self.assertEqual(zipfp.namelist(), ["absolute"])
+ def test_append(self):
+ # Test that appending to the Zip64 archive doesn't change
+ # extra fields of existing entries.
+ with zipfile.ZipFile(TESTFN2, "w", allowZip64=True) as zipfp:
+ zipfp.writestr("strfile", self.data)
+ with zipfile.ZipFile(TESTFN2, "r", allowZip64=True) as zipfp:
+ zinfo = zipfp.getinfo("strfile")
+ extra = zinfo.extra
+ with zipfile.ZipFile(TESTFN2, "a", allowZip64=True) as zipfp:
+ zipfp.writestr("strfile2", self.data)
+ with zipfile.ZipFile(TESTFN2, "r", allowZip64=True) as zipfp:
+ zinfo = zipfp.getinfo("strfile")
+ self.assertEqual(zinfo.extra, extra)
+
@requires_zlib
class DeflateTestZip64InSmallFiles(AbstractTestZip64InSmallFiles,
unittest.TestCase):