|
17 | 17 | from test.support import is_emscripten, is_wasi |
18 | 18 | from test.support import infinite_recursion |
19 | 19 | from test.support import os_helper |
20 | | -from test.support.os_helper import TESTFN, FakePath |
| 20 | +from test.support.os_helper import TESTFN, FS_NONASCII, FakePath |
21 | 21 | from test.test_pathlib import test_pathlib_abc |
22 | 22 | from test.test_pathlib.test_pathlib_abc import needs_posix, needs_windows, needs_symlinks |
23 | 23 |
|
@@ -479,12 +479,16 @@ def test_as_uri_windows(self): |
479 | 479 | self.assertEqual(P('c:/').as_uri(), 'file:///c:/') |
480 | 480 | self.assertEqual(P('c:/a/b.c').as_uri(), 'file:///c:/a/b.c') |
481 | 481 | self.assertEqual(P('c:/a/b%#c').as_uri(), 'file:///c:/a/b%25%23c') |
482 | | - self.assertEqual(P('c:/a/b\xe9').as_uri(), 'file:///c:/a/b%C3%A9') |
483 | 482 | self.assertEqual(P('//some/share/').as_uri(), 'file://some/share/') |
484 | 483 | self.assertEqual(P('//some/share/a/b.c').as_uri(), |
485 | 484 | 'file://some/share/a/b.c') |
486 | | - self.assertEqual(P('//some/share/a/b%#c\xe9').as_uri(), |
487 | | - 'file://some/share/a/b%25%23c%C3%A9') |
| 485 | + |
| 486 | + from urllib.parse import quote_from_bytes |
| 487 | + QUOTED_FS_NONASCII = quote_from_bytes(os.fsencode(FS_NONASCII)) |
| 488 | + self.assertEqual(P('c:/a/b' + FS_NONASCII).as_uri(), |
| 489 | + 'file:///c:/a/b' + QUOTED_FS_NONASCII) |
| 490 | + self.assertEqual(P('//some/share/a/b%#c' + FS_NONASCII).as_uri(), |
| 491 | + 'file://some/share/a/b%25%23c' + QUOTED_FS_NONASCII) |
488 | 492 |
|
489 | 493 | @needs_windows |
490 | 494 | def test_ordering_windows(self): |
|
0 commit comments