Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Lib/test/test_pathlib/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from test.support import is_emscripten, is_wasi
from test.support import infinite_recursion
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
from test.support.os_helper import TESTFN, FS_NONASCII, FakePath
from test.test_pathlib import test_pathlib_abc
from test.test_pathlib.test_pathlib_abc import needs_posix, needs_windows, needs_symlinks

Expand Down Expand Up @@ -479,12 +479,16 @@ def test_as_uri_windows(self):
self.assertEqual(P('c:/').as_uri(), 'file:///c:/')
self.assertEqual(P('c:/a/b.c').as_uri(), 'file:///c:/a/b.c')
self.assertEqual(P('c:/a/b%#c').as_uri(), 'file:///c:/a/b%25%23c')
self.assertEqual(P('c:/a/b\xe9').as_uri(), 'file:///c:/a/b%C3%A9')
self.assertEqual(P('//some/share/').as_uri(), 'file://some/share/')
self.assertEqual(P('//some/share/a/b.c').as_uri(),
'file://some/share/a/b.c')
self.assertEqual(P('//some/share/a/b%#c\xe9').as_uri(),
'file://some/share/a/b%25%23c%C3%A9')

from urllib.parse import quote_from_bytes
QUOTED_FS_NONASCII = quote_from_bytes(os.fsencode(FS_NONASCII))
self.assertEqual(P('c:/a/b' + FS_NONASCII).as_uri(),
'file:///c:/a/b' + QUOTED_FS_NONASCII)
self.assertEqual(P('//some/share/a/b%#c' + FS_NONASCII).as_uri(),
'file://some/share/a/b%25%23c' + QUOTED_FS_NONASCII)

@needs_windows
def test_ordering_windows(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_urllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def setUp(self):
finally:
f.close()
self.pathname = os_helper.TESTFN
self.quoted_pathname = urllib.parse.quote(self.pathname)
self.quoted_pathname = urllib.parse.quote(os.fsencode(self.pathname))
self.returned_obj = urlopen("file:%s" % self.quoted_pathname)

def tearDown(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_zipfile/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3489,7 +3489,7 @@ def test_cli_with_metadata_encoding_extract(self):
except OSError:
pass
except UnicodeEncodeError:
self.skipTest(f'cannot encode file name {fn!r}')
self.skipTest(f'cannot encode file name {fn!a}')

zipfile.main(["--metadata-encoding=shift_jis", "-e", TESTFN, TESTFN2])
listing = os.listdir(TESTFN2)
Expand Down
Loading