Skip to content

Commit 1ff26c0

Browse files
committed
Windows test fixes python#5
1 parent d4befde commit 1ff26c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/test/test_urllib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,11 +1575,11 @@ def test_url2pathname_win(self):
15751575
self.assertEqual(fn('///C|/path/to/file'), 'C:\\path\\to\\file')
15761576
self.assertEqual(fn("///C|/foo/bar/spam.foo"), 'C:\\foo\\bar\\spam.foo')
15771577
# Non-ASCII drive letter
1578-
self.assertEqual(fn("///\u00e8|/"), "\\\u00e8|\\")
1578+
self.assertEqual(fn("///\u00e8|/"), "u00e8:\\")
15791579
# UNC paths
15801580
self.assertEqual(fn('//server/path/to/file'), '\\\\server\\path\\to\\file')
15811581
self.assertEqual(fn('////server/path/to/file'), '\\\\server\\path\\to\\file')
1582-
self.assertEqual(fn('/////server/path/to/file'), '\\\\\\server\\path\\to\\file')
1582+
self.assertEqual(fn('/////server/path/to/file'), '\\\\server\\path\\to\\file')
15831583
# Localhost paths
15841584
self.assertEqual(fn('//localhost/C:/path/to/file'), 'C:\\path\\to\\file')
15851585
self.assertEqual(fn('//localhost/C|/path/to/file'), 'C:\\path\\to\\file')

Lib/urllib/request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ def url2pathname(url):
16541654
"""Convert the percent-encoded URL *url* to a local pathname."""
16551655
scheme, authority, path = urlsplit(url, scheme='file')[:3]
16561656
if scheme != 'file':
1657-
raise URLError(f'URI does not use "file" scheme: {url!r}')
1657+
raise URLError(f'URL {url!r} uses non-`file` scheme {scheme!r}')
16581658
if os.name == 'nt':
16591659
path = unquote(path)
16601660
if authority and authority != 'localhost':
@@ -1673,7 +1673,7 @@ def url2pathname(url):
16731673
path = path.replace('/', '\\')
16741674
else:
16751675
if not _is_local_host(authority):
1676-
raise URLError(f'file URI not on local host: {url!r}')
1676+
raise URLError(f'URL {url!r} uses non-local authority {authority!r}')
16771677
path = unquote(path)
16781678
return path
16791679

0 commit comments

Comments
 (0)