summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2023-02-17 14:05:38 (GMT)
committerGitHub <noreply@github.com>2023-02-17 14:05:38 (GMT)
commitd401b20630965c0e1d2a5a0d60d5fc51aa5a8d80 (patch)
treee2401d36917725d2bede97de574ccfd906f84a60 /Lib/test/test_ntpath.py
parent775f8819e319127f9bfb046773b74bcc62c68b6a (diff)
downloadcpython-d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80.zip
cpython-d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80.tar.gz
cpython-d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80.tar.bz2
gh-101360: Fix anchor matching in pathlib.PureWindowsPath.match() (GH-101363)
Use `fnmatch` to match path and pattern anchors, just as we do for other path parts. This allows patterns such as `'*:/Users/*'` to be matched.
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r--Lib/test/test_ntpath.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index b329006..08c8a7a 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -200,6 +200,10 @@ class TestNtpath(NtpathTestCase):
tester('ntpath.splitroot("//x")', ("//x", "", "")) # non-empty server & missing share
tester('ntpath.splitroot("//x/")', ("//x/", "", "")) # non-empty server & empty share
+ # gh-101363: match GetFullPathNameW() drive letter parsing behaviour
+ tester('ntpath.splitroot(" :/foo")', (" :", "/", "foo"))
+ tester('ntpath.splitroot("/:/foo")', ("", "/", ":/foo"))
+
def test_split(self):
tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")',