summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNice Zombies <nineteendo19d0@gmail.com>2024-11-21 14:43:36 (GMT)
committerGitHub <noreply@github.com>2024-11-21 14:43:36 (GMT)
commit60ec854bc297e04718fe13db3605d0465bf8badb (patch)
tree98e06da03433b3e10b0ad9ac181bded4cbd6ba48 /Lib
parent0c5556fcb7315f26aa4b192e341cb2a72bb78f41 (diff)
downloadcpython-60ec854bc297e04718fe13db3605d0465bf8badb.zip
cpython-60ec854bc297e04718fe13db3605d0465bf8badb.tar.gz
cpython-60ec854bc297e04718fe13db3605d0465bf8badb.tar.bz2
gh-126780: Fix `ntpath.normpath()` for drive-relative paths (GH-126801)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_ntpath.py5
-rw-r--r--Lib/test/test_posixpath.py2
2 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 4f59184..6715071 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -347,13 +347,18 @@ class TestNtpath(NtpathTestCase):
tester("ntpath.normpath('..')", r'..')
tester("ntpath.normpath('.')", r'.')
+ tester("ntpath.normpath('c:.')", 'c:')
tester("ntpath.normpath('')", r'.')
tester("ntpath.normpath('/')", '\\')
tester("ntpath.normpath('c:/')", 'c:\\')
tester("ntpath.normpath('/../.././..')", '\\')
tester("ntpath.normpath('c:/../../..')", 'c:\\')
+ tester("ntpath.normpath('/./a/b')", r'\a\b')
+ tester("ntpath.normpath('c:/./a/b')", r'c:\a\b')
tester("ntpath.normpath('../.././..')", r'..\..\..')
tester("ntpath.normpath('K:../.././..')", r'K:..\..\..')
+ tester("ntpath.normpath('./a/b')", r'a\b')
+ tester("ntpath.normpath('c:./a/b')", r'c:a\b')
tester("ntpath.normpath('C:////a/b')", r'C:\a\b')
tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b')
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index b39255eb..43e4fbc 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -379,6 +379,7 @@ class PosixPathTest(unittest.TestCase):
("/.", "/"),
("/./", "/"),
("/.//.", "/"),
+ ("/./foo/bar", "/foo/bar"),
("/foo", "/foo"),
("/foo/bar", "/foo/bar"),
("//", "//"),
@@ -388,6 +389,7 @@ class PosixPathTest(unittest.TestCase):
("///..//./foo/.//bar", "/foo/bar"),
(".", "."),
(".//.", "."),
+ ("./foo/bar", "foo/bar"),
("..", ".."),
("../", ".."),
("../foo", "../foo"),