Skip to content

Commit

Permalink
Add some assertions about malformed paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed May 31, 2024
1 parent 2d015c2 commit 79a309f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,21 @@ def test_getinfo_missing(self, alpharep):
zipfile.Path(alpharep)
with self.assertRaises(KeyError):
alpharep.getinfo('does-not-exist')

@__import__('pytest').mark.skip(reason="infinite loop")
def test_malformed_paths(self):
"""
Path should handle malformed paths.
"""
data = io.BytesIO()
zf = zipfile.ZipFile(data, "w")
zf.writestr("/one-slash.txt", b"content")
zf.writestr("//two-slash.txt", b"content")
zf.writestr("../parent.txt", b"content")
zf.filename = ''
root = zipfile.Path(zf)
assert list(map(str, root.iterdir())) == [
'one-slash.txt',
'two-slash.txt',
'parent.txt',
]

0 comments on commit 79a309f

Please sign in to comment.