mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-81790: support "UNC" device paths in ntpath.splitdrive()
(GH-91882)
This commit is contained in:
parent
53a8b17895
commit
2ba0fd5767
5 changed files with 39 additions and 66 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue