bpo-39667: Sync zipp 3.0 (GH-18540)
* bpo-39667: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0
* 📜🤖 Added by blurb_it.
* Update docs for new zipfile.Path.open
* Rely on dict, faster than OrderedDict.
* Syntax edits on docs
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 09fc850..643c5b4 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -5,6 +5,7 @@
import os
import pathlib
import posixpath
+import string
import struct
import subprocess
import sys
@@ -2880,7 +2881,7 @@
a, b, g = root.iterdir()
with a.open() as strm:
data = strm.read()
- assert data == b"content of a"
+ assert data == "content of a"
def test_read(self):
for alpharep in self.zipfile_alpharep():
@@ -2974,6 +2975,11 @@
# Check the file iterated all items
assert entries.count == self.HUGE_ZIPFILE_NUM_ENTRIES
+ # @func_timeout.func_set_timeout(3)
+ def test_implied_dirs_performance(self):
+ data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)]
+ zipfile.CompleteDirs._implied_dirs(data)
+
if __name__ == "__main__":
unittest.main()