bpo-46208: Fix normalization of relative paths in _Py_normpath()/os.path.normpath (GH-30362)

This commit is contained in:
neonene 2022-01-07 04:13:10 +09:00 committed by GitHub
parent 9925e70e48
commit 9c5fa9c97c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 9 deletions

View file

@ -329,13 +329,30 @@ class PosixPathTest(unittest.TestCase):
("/..", "/"),
("/../", "/"),
("/..//", "/"),
("//.", "//"),
("//..", "//"),
("//...", "//..."),
("//../foo", "//foo"),
("//../../foo", "//foo"),
("/../foo", "/foo"),
("/../../foo", "/foo"),
("/../foo/../", "/"),
("/../foo/../bar", "/bar"),
("/../../foo/../bar/./baz/boom/..", "/bar/baz"),
("/../../foo/../bar/./baz/boom/.", "/bar/baz/boom"),
("foo/../bar/baz", "bar/baz"),
("foo/../../bar/baz", "../bar/baz"),
("foo/../../../bar/baz", "../../bar/baz"),
("foo///../bar/.././../baz/boom", "../baz/boom"),
("foo/bar/../..///../../baz/boom", "../../baz/boom"),
("/foo/..", "/"),
("/foo/../..", "/"),
("//foo/..", "//"),
("//foo/../..", "//"),
("///foo/..", "/"),
("///foo/../..", "/"),
("////foo/..", "/"),
("/////foo/..", "/"),
]
def test_normpath(self):