Tweaks to make the codecmaps tests pass again.

(To run these, you need to pass -uurlfetch to regrtest.py or runtests.sh.)
This commit is contained in:
Guido van Rossum 2007-07-23 18:06:59 +00:00
parent 4ca9471831
commit 005ebb1f7c
4 changed files with 20 additions and 20 deletions

View File

@ -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,

View File

@ -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__)

View File

@ -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():

View File

@ -284,15 +284,15 @@ def test_mapping_file(self):
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