Skip to content

Commit

Permalink
Refine expectation that paths with leading slashes are simply not vis…
Browse files Browse the repository at this point in the history
…ible.
  • Loading branch information
jaraco committed Aug 26, 2024
1 parent f89b93f commit 0a3a7b4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .compat.py39.os_helper import temp_dir, FakePath # type: ignore[import-not-found]

import pytest
import jaraco.itertools
from jaraco.functools import compose

Expand Down Expand Up @@ -585,10 +584,13 @@ def test_getinfo_missing(self, alpharep):
with self.assertRaises(KeyError):
alpharep.getinfo('does-not-exist')

@pytest.mark.xfail(reason="python/cpython#123270")
def test_malformed_paths(self):
"""
Path should handle malformed paths.
Path should handle malformed paths gracefully.
Paths with leading slashes are not visible.
Paths with dots are treated like regular files.
"""
data = io.BytesIO()
zf = zipfile.ZipFile(data, "w")
Expand All @@ -597,11 +599,7 @@ def test_malformed_paths(self):
zf.writestr("../parent.txt", b"content")
zf.filename = ''
root = zipfile.Path(zf)
assert list(map(str, root.iterdir())) == [
'one-slash.txt',
'two-slash.txt',
'..',
]
assert list(map(str, root.iterdir())) == ['../']
assert root.joinpath('..').joinpath('parent.txt').read_bytes() == b'content'

def test_unsupported_names(self):
Expand Down

0 comments on commit 0a3a7b4

Please sign in to comment.