From: Antoine Pitrou Date: Fri, 22 Nov 2013 16:57:03 +0000 (+0100) Subject: Fix test failure under systems with an incompatible locale X-Git-Tag: v3.4.0b1~117 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29eac42f4996323318c5dcbe670f3a382fda5db9;p=thirdparty%2FPython%2Fcpython.git Fix test failure under systems with an incompatible locale --- diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 8c0c430d5a57..7ece1f596924 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')))