mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539)
This commit is contained in:
parent
7d37b86ad4
commit
3513d55a61
3 changed files with 29 additions and 1 deletions
|
@ -1526,6 +1526,24 @@ class Pathname_Tests(unittest.TestCase):
|
|||
"url2pathname() failed; %s != %s" %
|
||||
(expect, result))
|
||||
|
||||
@unittest.skipUnless(sys.platform == 'win32',
|
||||
'test specific to the nturl2path functions.')
|
||||
def test_prefixes(self):
|
||||
# Test special prefixes are correctly handled in pathname2url()
|
||||
given = '\\\\?\\C:\\dir'
|
||||
expect = '///C:/dir'
|
||||
result = urllib.request.pathname2url(given)
|
||||
self.assertEqual(expect, result,
|
||||
"pathname2url() failed; %s != %s" %
|
||||
(expect, result))
|
||||
given = '\\\\?\\unc\\server\\share\\dir'
|
||||
expect = '/server/share/dir'
|
||||
result = urllib.request.pathname2url(given)
|
||||
self.assertEqual(expect, result,
|
||||
"pathname2url() failed; %s != %s" %
|
||||
(expect, result))
|
||||
|
||||
|
||||
@unittest.skipUnless(sys.platform == 'win32',
|
||||
'test specific to the urllib.url2path function.')
|
||||
def test_ntpath(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue