summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r--Lib/test/test_ntpath.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index ab3603b..d519463 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -117,6 +117,31 @@ class TestNtpath(NtpathTestCase):
# Issue #19911: UNC part containing U+0130
self.assertEqual(ntpath.splitdrive('//conky/MOUNTPOİNT/foo/bar'),
('//conky/MOUNTPOİNT', '/foo/bar'))
+ # gh-81790: support device namespace, including UNC drives.
+ tester('ntpath.splitdrive("//?/c:")', ("//?/c:", ""))
+ tester('ntpath.splitdrive("//?/c:/")', ("//?/c:", "/"))
+ tester('ntpath.splitdrive("//?/c:/dir")', ("//?/c:", "/dir"))
+ tester('ntpath.splitdrive("//?/UNC")', ("", "//?/UNC"))
+ tester('ntpath.splitdrive("//?/UNC/")', ("", "//?/UNC/"))
+ tester('ntpath.splitdrive("//?/UNC/server/")', ("//?/UNC/server/", ""))
+ tester('ntpath.splitdrive("//?/UNC/server/share")', ("//?/UNC/server/share", ""))
+ tester('ntpath.splitdrive("//?/UNC/server/share/dir")', ("//?/UNC/server/share", "/dir"))
+ tester('ntpath.splitdrive("//?/VOLUME{00000000-0000-0000-0000-000000000000}/spam")',
+ ('//?/VOLUME{00000000-0000-0000-0000-000000000000}', '/spam'))
+ tester('ntpath.splitdrive("//?/BootPartition/")', ("//?/BootPartition", "/"))
+
+ tester('ntpath.splitdrive("\\\\?\\c:")', ("\\\\?\\c:", ""))
+ tester('ntpath.splitdrive("\\\\?\\c:\\")', ("\\\\?\\c:", "\\"))
+ tester('ntpath.splitdrive("\\\\?\\c:\\dir")', ("\\\\?\\c:", "\\dir"))
+ tester('ntpath.splitdrive("\\\\?\\UNC")', ("", "\\\\?\\UNC"))
+ tester('ntpath.splitdrive("\\\\?\\UNC\\")', ("", "\\\\?\\UNC\\"))
+ tester('ntpath.splitdrive("\\\\?\\UNC\\server\\")', ("\\\\?\\UNC\\server\\", ""))
+ tester('ntpath.splitdrive("\\\\?\\UNC\\server\\share")', ("\\\\?\\UNC\\server\\share", ""))
+ tester('ntpath.splitdrive("\\\\?\\UNC\\server\\share\\dir")',
+ ("\\\\?\\UNC\\server\\share", "\\dir"))
+ tester('ntpath.splitdrive("\\\\?\\VOLUME{00000000-0000-0000-0000-000000000000}\\spam")',
+ ('\\\\?\\VOLUME{00000000-0000-0000-0000-000000000000}', '\\spam'))
+ tester('ntpath.splitdrive("\\\\?\\BootPartition\\")', ("\\\\?\\BootPartition", "\\"))
def test_split(self):
tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))