From b29d5df9b8839a845807a5cf02e47d4d7dbdd6ee Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Oct 2015 22:28:34 +0100 Subject: [PATCH] compat: Avoid non-ASCII in byte literals --- tests/internal/test_path.py | 2 +- tests/local/test_translator.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/internal/test_path.py b/tests/internal/test_path.py index 0d266725..8aa8f7c1 100644 --- a/tests/internal/test_path.py +++ b/tests/internal/test_path.py @@ -133,7 +133,7 @@ class GetOrCreateFileTest(unittest.TestCase): file_path = os.path.join(self.parent, b'test') created = path.get_or_create_file(file_path, content='foobaræøå') with open(created) as fh: - self.assertEqual(fh.read(), b'foobaræøå') + self.assertEqual(fh.read(), b'foobar\xc3\xa6\xc3\xb8\xc3\xa5') class PathToFileURITest(unittest.TestCase): diff --git a/tests/local/test_translator.py b/tests/local/test_translator.py index 124766dd..e28de173 100644 --- a/tests/local/test_translator.py +++ b/tests/local/test_translator.py @@ -42,11 +42,15 @@ def test_local_uri_to_file_uri_errors(uri): ('local:directory:A/B', b'/home/alice/Music/A/B'), ('local:directory:A%20B', b'/home/alice/Music/A B'), ('local:directory:A+B', b'/home/alice/Music/A+B'), - ('local:directory:%C3%A6%C3%B8%C3%A5', b'/home/alice/Music/æøå'), + ( + 'local:directory:%C3%A6%C3%B8%C3%A5', + b'/home/alice/Music/\xc3\xa6\xc3\xb8\xc3\xa5'), ('local:track:A/B.mp3', b'/home/alice/Music/A/B.mp3'), ('local:track:A%20B.mp3', b'/home/alice/Music/A B.mp3'), ('local:track:A+B.mp3', b'/home/alice/Music/A+B.mp3'), - ('local:track:%C3%A6%C3%B8%C3%A5.mp3', b'/home/alice/Music/æøå.mp3'), + ( + 'local:track:%C3%A6%C3%B8%C3%A5.mp3', + b'/home/alice/Music/\xc3\xa6\xc3\xb8\xc3\xa5.mp3'), ]) def test_local_uri_to_path(uri, path): media_dir = b'/home/alice/Music'