From 3798bb6beadd5ababd15797f0e13ba0338e5347d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 26 Aug 2024 10:38:25 -0400 Subject: [PATCH] Refine expectation that paths with leading slashes are simply not visible. --- tests/test_path.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/test_path.py b/tests/test_path.py index b67674c..9219284 100644 --- a/tests/test_path.py +++ b/tests/test_path.py @@ -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 @@ -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") @@ -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):