mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #19912: Fixed numerous bugs in ntpath.splitunc().
* splitunc() no more return illegal result for paths with redundant slashes. * splitunc() now correctly processes the 'İ' character (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE). * Deprecation warnings now emitted for every use of splitunc(). * Added tests for splitunc().
This commit is contained in:
commit
cc83b0c8f6
3 changed files with 33 additions and 20 deletions
|
@ -70,6 +70,29 @@ class TestNtpath(unittest.TestCase):
|
|||
self.assertEqual(ntpath.splitdrive('//conky/MOUNTPOİNT/foo/bar'),
|
||||
('//conky/MOUNTPOİNT', '/foo/bar'))
|
||||
|
||||
def test_splitunc(self):
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
ntpath.splitunc('')
|
||||
with support.check_warnings(('', DeprecationWarning)):
|
||||
tester('ntpath.splitunc("c:\\foo\\bar")',
|
||||
('', 'c:\\foo\\bar'))
|
||||
tester('ntpath.splitunc("c:/foo/bar")',
|
||||
('', 'c:/foo/bar'))
|
||||
tester('ntpath.splitunc("\\\\conky\\mountpoint\\foo\\bar")',
|
||||
('\\\\conky\\mountpoint', '\\foo\\bar'))
|
||||
tester('ntpath.splitunc("//conky/mountpoint/foo/bar")',
|
||||
('//conky/mountpoint', '/foo/bar'))
|
||||
tester('ntpath.splitunc("\\\\\\conky\\mountpoint\\foo\\bar")',
|
||||
('', '\\\\\\conky\\mountpoint\\foo\\bar'))
|
||||
tester('ntpath.splitunc("///conky/mountpoint/foo/bar")',
|
||||
('', '///conky/mountpoint/foo/bar'))
|
||||
tester('ntpath.splitunc("\\\\conky\\\\mountpoint\\foo\\bar")',
|
||||
('', '\\\\conky\\\\mountpoint\\foo\\bar'))
|
||||
tester('ntpath.splitunc("//conky//mountpoint/foo/bar")',
|
||||
('', '//conky//mountpoint/foo/bar'))
|
||||
self.assertEqual(ntpath.splitunc('//conky/MOUNTPOİNT/foo/bar'),
|
||||
('//conky/MOUNTPOİNT', '/foo/bar'))
|
||||
|
||||
def test_split(self):
|
||||
tester('ntpath.split("c:\\foo\\bar")', ('c:\\foo', 'bar'))
|
||||
tester('ntpath.split("\\\\conky\\mountpoint\\foo\\bar")',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue