summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2019-05-09 15:34:36 (GMT)
committerBarry Warsaw <barry@python.org>2019-05-09 15:34:35 (GMT)
commit33e067d6a237ced8fd2ead70a461025fd91239be (patch)
treef56fa5bd7fd75c19d3119803a268638ef5948322 /Lib/test/test_zipfile.py
parentafd1e6d2f0f5aaf4030d13342809ec0915dedf81 (diff)
downloadcpython-33e067d6a237ced8fd2ead70a461025fd91239be.zip
cpython-33e067d6a237ced8fd2ead70a461025fd91239be.tar.gz
cpython-33e067d6a237ced8fd2ead70a461025fd91239be.tar.bz2
Add support for .parent and .joinpath in zipfile.Path (#13213)
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 538d4ee..bf5bb4d 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -2481,6 +2481,14 @@ class TestPath(unittest.TestCase):
assert a.read_text() == "content of a"
assert a.read_bytes() == b"content of a"
+ def test_joinpath(self):
+ for zipfile_abcde in self.zipfile_abcde():
+ root = zipfile.Path(zipfile_abcde)
+ a = root.joinpath("a")
+ assert a.is_file()
+ e = root.joinpath("b").joinpath("d").joinpath("e.txt")
+ assert e.read_text() == "content of e"
+
def test_traverse_truediv(self):
for zipfile_abcde in self.zipfile_abcde():
root = zipfile.Path(zipfile_abcde)
@@ -2502,5 +2510,11 @@ class TestPath(unittest.TestCase):
root = zipfile.Path(zipfile_abcde)
root / pathlib.Path("a")
+ def test_parent(self):
+ for zipfile_abcde in self.zipfile_abcde():
+ root = zipfile.Path(zipfile_abcde)
+ assert (root / 'a').parent.at == ''
+ assert (root / 'a' / 'b').parent.at == 'a/'
+
if __name__ == "__main__":
unittest.main()