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

@ -235,6 +235,15 @@ class TestNtpath(NtpathTestCase):
tester("ntpath.normpath('\\\\.\\NUL')", r'\\.\NUL')
tester("ntpath.normpath('\\\\?\\D:/XY\\Z')", r'\\?\D:/XY\Z')
tester("ntpath.normpath('handbook/../../Tests/image.png')", r'..\Tests\image.png')
tester("ntpath.normpath('handbook/../../../Tests/image.png')", r'..\..\Tests\image.png')
tester("ntpath.normpath('handbook///../a/.././../b/c')", r'..\b\c')
tester("ntpath.normpath('handbook/a/../..///../../b/c')", r'..\..\b\c')
tester("ntpath.normpath('//server/share/..')" , '\\\\server\\share\\')
tester("ntpath.normpath('//server/share/../')" , '\\\\server\\share\\')
tester("ntpath.normpath('//server/share/../..')", '\\\\server\\share\\')
tester("ntpath.normpath('//server/share/../../')", '\\\\server\\share\\')
def test_realpath_curdir(self):
expected = ntpath.normpath(os.getcwd())