diff options
author | Steve Dower <steve.dower@python.org> | 2021-04-23 17:02:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 17:02:47 (GMT) |
commit | 3513d55a617012002c3f82dbf3cec7ec1abd7090 (patch) | |
tree | 8af292b4e8d90e430de4cde0dc2244ba7e2fe82a /Lib/test/test_urllib.py | |
parent | 7d37b86ad48368cf93440ca220b758696730d0e5 (diff) | |
download | cpython-3513d55a617012002c3f82dbf3cec7ec1abd7090.zip cpython-3513d55a617012002c3f82dbf3cec7ec1abd7090.tar.gz cpython-3513d55a617012002c3f82dbf3cec7ec1abd7090.tar.bz2 |
bpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539)
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r-- | Lib/test/test_urllib.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index f41fa2a..82f1d9d 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -1527,6 +1527,24 @@ class Pathname_Tests(unittest.TestCase): (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): given = ('/C:/', '///C:/', '/C|//') |