[Python-3000-checkins] r56513 - python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py

guido.van.rossum python-3000-checkins at python.org
Mon Jul 23 20:06:59 CEST 2007


Author: guido.van.rossum
Date: Mon Jul 23 20:06:59 2007
New Revision: 56513

Modified:
   python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py
   python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py
   python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py
   python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py
Log:
Tweaks to make the codecmaps tests pass again.
(To run these, you need to pass -uurlfetch to regrtest.py or runtests.sh.)


Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_codecmaps_jp.py	Mon Jul 23 20:06:59 2007
@@ -14,14 +14,14 @@
     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 @@
     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,

Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_codecmaps_kr.py	Mon Jul 23 20:06:59 2007
@@ -30,8 +30,8 @@
     # 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__)

Modified: python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_codecmaps_tw.py	Mon Jul 23 20:06:59 2007
@@ -20,8 +20,8 @@
     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():

Modified: python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_multibytecodec_support.py	Mon Jul 23 20:06:59 2007
@@ -284,15 +284,15 @@
 
             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
 


More information about the Python-3000-checkins mailing list