diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-12-15 21:12:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-15 18:12:54 -0800 |
| commit | 928dbfc16c9c4715459c80fe551c74702480db8b (patch) | |
| tree | 1da038399be37bf24e597725c179a329697d88be /Lib | |
| parent | b230409f21f5e5b42de6ec10147cd95ae3bdd095 (diff) | |
| download | cpython-git-928dbfc16c9c4715459c80fe551c74702480db8b.tar.gz | |
bpo-42090: zipfile.Path.joinpath now accepts multiple arguments (GH-22976)
Automerge-Triggered-By: GH:jaraco
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/test/test_zipfile.py | 6 | ||||
| -rw-r--r-- | Lib/zipfile.py | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index b3c24213f3..7c09e2f51b 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -2966,6 +2966,12 @@ class TestPath(unittest.TestCase): assert e.read_text() == "content of e" @pass_alpharep + def test_joinpath_multiple(self, alpharep): + root = zipfile.Path(alpharep) + e = root.joinpath("b", "d", "e.txt") + assert e.read_text() == "content of e" + + @pass_alpharep def test_traverse_truediv(self, alpharep): root = zipfile.Path(alpharep) a = root / "a.txt" diff --git a/Lib/zipfile.py b/Lib/zipfile.py index e1a50a3eb5..0eed4ce9a6 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -2379,8 +2379,8 @@ class Path: def __repr__(self): return self.__repr.format(self=self) - def joinpath(self, add): - next = posixpath.join(self.at, add) + def joinpath(self, *other): + next = posixpath.join(self.at, *other) return self._next(self.root.resolve_dir(next)) __truediv__ = joinpath |
