summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-06-22 08:24:11 (GMT)
committerGitHub <noreply@github.com>2020-06-22 08:24:11 (GMT)
commit36ff513f82e372ed3cea0bf7cbdf15a1ef6dab9e (patch)
tree0f488ab543c1728b4759f844d884fe2c265bdbf3 /Lib/test/test_zipfile.py
parentc88239f864a27f673c0f0a9e62d2488563f9d081 (diff)
downloadcpython-36ff513f82e372ed3cea0bf7cbdf15a1ef6dab9e.zip
cpython-36ff513f82e372ed3cea0bf7cbdf15a1ef6dab9e.tar.gz
cpython-36ff513f82e372ed3cea0bf7cbdf15a1ef6dab9e.tar.bz2
bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040)
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r--Lib/test/test_zipfile.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index c9ca1dd..b7bc218 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -1600,6 +1600,11 @@ class OtherTests(unittest.TestCase):
self.assertEqual(zf.filelist[0].filename, "foo.txt")
self.assertEqual(zf.filelist[1].filename, "\xf6.txt")
+ def test_read_after_write_unicode_filenames(self):
+ with zipfile.ZipFile(TESTFN2, 'w') as zipfp:
+ zipfp.writestr('приклад', b'sample')
+ self.assertEqual(zipfp.read('приклад'), b'sample')
+
def test_exclusive_create_zip_file(self):
"""Test exclusive creating a new zipfile."""
unlink(TESTFN2)