summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-11-22 16:57:03 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-11-22 16:57:03 (GMT)
commit29eac42f4996323318c5dcbe670f3a382fda5db9 (patch)
treec8af40e6bfe1c5ea17c6ab6dac3587e94f5a0f25 /Lib/test/test_pathlib.py
parent0325a21da38e3335db27d890cdc824aff272086b (diff)
downloadcpython-29eac42f4996323318c5dcbe670f3a382fda5db9.zip
cpython-29eac42f4996323318c5dcbe670f3a382fda5db9.tar.gz
cpython-29eac42f4996323318c5dcbe670f3a382fda5db9.tar.bz2
Fix test failure under systems with an incompatible locale
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rwxr-xr-xLib/test/test_pathlib.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 8c0c430..7ece1f5 100755
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -586,11 +586,18 @@ class PurePosixPathTest(_BasePurePathTest, unittest.TestCase):
self.assertNotEqual(P('/a'), P('//a'))
def test_as_uri(self):
- from urllib.parse import quote_from_bytes
P = self.cls
self.assertEqual(P('/').as_uri(), 'file:///')
self.assertEqual(P('/a/b.c').as_uri(), 'file:///a/b.c')
self.assertEqual(P('/a/b%#c').as_uri(), 'file:///a/b%25%23c')
+
+ def test_as_uri_non_ascii(self):
+ from urllib.parse import quote_from_bytes
+ P = self.cls
+ try:
+ os.fsencode('\xe9')
+ except UnicodeEncodeError:
+ self.skipTest("\\xe9 cannot be encoded to the filesystem encoding")
self.assertEqual(P('/a/b\xe9').as_uri(),
'file:///a/b' + quote_from_bytes(os.fsencode('\xe9')))