diff options
author | neonene <53406459+neonene@users.noreply.github.com> | 2022-01-06 19:13:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 19:13:10 (GMT) |
commit | 9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7 (patch) | |
tree | 97d9ab902046a3af10a6f44e9ad993d6e31c154a /Lib/test/test_ntpath.py | |
parent | 9925e70e4811841556747a77acd89c1a70bf344a (diff) | |
download | cpython-9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7.zip cpython-9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7.tar.gz cpython-9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7.tar.bz2 |
bpo-46208: Fix normalization of relative paths in _Py_normpath()/os.path.normpath (GH-30362)
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r-- | Lib/test/test_ntpath.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py index a8d87e5..cc29881 100644 --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -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()) |