From 005ebb1f7c40bdacd25fba8cae232ad2fb6c4c84 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 23 Jul 2007 18:06:59 +0000 Subject: Tweaks to make the codecmaps tests pass again. (To run these, you need to pass -uurlfetch to regrtest.py or runtests.sh.) --- Lib/test/test_codecmaps_jp.py | 20 ++++++++++---------- Lib/test/test_codecmaps_kr.py | 4 ++-- Lib/test/test_codecmaps_tw.py | 4 ++-- Lib/test/test_multibytecodec_support.py | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Lib/test/test_codecmaps_jp.py b/Lib/test/test_codecmaps_jp.py index 31b80eb..dec97fb 100644 --- a/Lib/test/test_codecmaps_jp.py +++ b/Lib/test/test_codecmaps_jp.py @@ -14,14 +14,14 @@ class TestCP932Map(test_multibytecodec_support.TestBase_Mapping, mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ 'WINDOWS/CP932.TXT' supmaps = [ - ('\x80', '\u0080'), - ('\xa0', '\uf8f0'), - ('\xfd', '\uf8f1'), - ('\xfe', '\uf8f2'), - ('\xff', '\uf8f3'), + (b'\x80', '\u0080'), + (b'\xa0', '\uf8f0'), + (b'\xfd', '\uf8f1'), + (b'\xfe', '\uf8f2'), + (b'\xff', '\uf8f3'), ] for i in range(0xa1, 0xe0): - supmaps.append((chr(i), chr(i+0xfec0))) + supmaps.append((bytes([i]), chr(i+0xfec0))) class TestEUCJPCOMPATMap(test_multibytecodec_support.TestBase_Mapping, @@ -38,12 +38,12 @@ class TestSJISCOMPATMap(test_multibytecodec_support.TestBase_Mapping, mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \ '/EASTASIA/JIS/SHIFTJIS.TXT' pass_enctest = [ - ('\x81_', '\\'), + (b'\x81_', '\\'), ] pass_dectest = [ - ('\\', '\xa5'), - ('~', '\u203e'), - ('\x81_', '\\'), + (b'\\', '\xa5'), + (b'~', '\u203e'), + (b'\x81_', '\\'), ] class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping, diff --git a/Lib/test/test_codecmaps_kr.py b/Lib/test/test_codecmaps_kr.py index 3f06187..4a97611 100644 --- a/Lib/test/test_codecmaps_kr.py +++ b/Lib/test/test_codecmaps_kr.py @@ -30,8 +30,8 @@ class TestJOHABMap(test_multibytecodec_support.TestBase_Mapping, # but, in early 90s that is the only era used johab widely, # the most softwares implements it as REVERSE SOLIDUS. # So, we ignore the standard here. - pass_enctest = [('\\', '\u20a9')] - pass_dectest = [('\\', '\u20a9')] + pass_enctest = [(b'\\', '\u20a9')] + pass_dectest = [(b'\\', '\u20a9')] def test_main(): test_support.run_unittest(__name__) diff --git a/Lib/test/test_codecmaps_tw.py b/Lib/test/test_codecmaps_tw.py index 71402c4..4bd1966 100644 --- a/Lib/test/test_codecmaps_tw.py +++ b/Lib/test/test_codecmaps_tw.py @@ -20,8 +20,8 @@ class TestCP950Map(test_multibytecodec_support.TestBase_Mapping, mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ 'WINDOWS/CP950.TXT' pass_enctest = [ - ('\xa2\xcc', '\u5341'), - ('\xa2\xce', '\u5345'), + (b'\xa2\xcc', '\u5341'), + (b'\xa2\xce', '\u5345'), ] def test_main(): diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py index ad73bad..40a67ea 100644 --- a/Lib/test/test_multibytecodec_support.py +++ b/Lib/test/test_multibytecodec_support.py @@ -284,15 +284,15 @@ class TestBase_Mapping(unittest.TestCase): csetval = eval(data[0]) if csetval <= 0x7F: - csetch = chr(csetval & 0xff) + csetch = bytes([csetval & 0xff]) elif csetval >= 0x1000000: - csetch = chr(csetval >> 24) + chr((csetval >> 16) & 0xff) + \ - chr((csetval >> 8) & 0xff) + chr(csetval & 0xff) + csetch = bytes([(csetval >> 24), ((csetval >> 16) & 0xff), + ((csetval >> 8) & 0xff), (csetval & 0xff)]) elif csetval >= 0x10000: - csetch = chr(csetval >> 16) + \ - chr((csetval >> 8) & 0xff) + chr(csetval & 0xff) + csetch = bytes([(csetval >> 16), ((csetval >> 8) & 0xff), + (csetval & 0xff)]) elif csetval >= 0x100: - csetch = chr(csetval >> 8) + chr(csetval & 0xff) + csetch = bytes([(csetval >> 8), (csetval & 0xff)]) else: continue -- cgit v0.12