2004-01-17 10:29:29 -04:00
|
|
|
#
|
|
|
|
# test_codecmaps_jp.py
|
|
|
|
# Codec mapping tests for Japanese encodings
|
|
|
|
#
|
|
|
|
|
2008-05-20 18:35:26 -03:00
|
|
|
from test import support
|
2012-04-09 10:37:52 -03:00
|
|
|
from test import multibytecodec_support
|
2004-01-17 10:29:29 -04:00
|
|
|
import unittest
|
|
|
|
|
2012-04-09 10:37:52 -03:00
|
|
|
class TestCP932Map(multibytecodec_support.TestBase_Mapping,
|
2004-01-17 10:29:29 -04:00
|
|
|
unittest.TestCase):
|
|
|
|
encoding = 'cp932'
|
|
|
|
mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \
|
|
|
|
'WINDOWS/CP932.TXT'
|
|
|
|
supmaps = [
|
2007-07-23 15:06:59 -03:00
|
|
|
(b'\x80', '\u0080'),
|
|
|
|
(b'\xa0', '\uf8f0'),
|
|
|
|
(b'\xfd', '\uf8f1'),
|
|
|
|
(b'\xfe', '\uf8f2'),
|
|
|
|
(b'\xff', '\uf8f3'),
|
2004-01-17 10:29:29 -04:00
|
|
|
]
|
|
|
|
for i in range(0xa1, 0xe0):
|
2007-07-23 15:06:59 -03:00
|
|
|
supmaps.append((bytes([i]), chr(i+0xfec0)))
|
2004-01-17 10:29:29 -04:00
|
|
|
|
|
|
|
|
2012-04-09 10:37:52 -03:00
|
|
|
class TestEUCJPCOMPATMap(multibytecodec_support.TestBase_Mapping,
|
2004-01-17 10:29:29 -04:00
|
|
|
unittest.TestCase):
|
|
|
|
encoding = 'euc_jp'
|
|
|
|
mapfilename = 'EUC-JP.TXT'
|
|
|
|
mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JP.TXT'
|
|
|
|
|
|
|
|
|
2012-04-09 10:37:52 -03:00
|
|
|
class TestSJISCOMPATMap(multibytecodec_support.TestBase_Mapping,
|
2004-01-17 10:29:29 -04:00
|
|
|
unittest.TestCase):
|
|
|
|
encoding = 'shift_jis'
|
|
|
|
mapfilename = 'SHIFTJIS.TXT'
|
|
|
|
mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \
|
|
|
|
'/EASTASIA/JIS/SHIFTJIS.TXT'
|
|
|
|
pass_enctest = [
|
2007-07-23 15:06:59 -03:00
|
|
|
(b'\x81_', '\\'),
|
2004-01-17 10:29:29 -04:00
|
|
|
]
|
|
|
|
pass_dectest = [
|
2007-07-23 15:06:59 -03:00
|
|
|
(b'\\', '\xa5'),
|
|
|
|
(b'~', '\u203e'),
|
|
|
|
(b'\x81_', '\\'),
|
2004-01-17 10:29:29 -04:00
|
|
|
]
|
|
|
|
|
2012-04-09 10:37:52 -03:00
|
|
|
class TestEUCJISX0213Map(multibytecodec_support.TestBase_Mapping,
|
2004-01-17 10:29:29 -04:00
|
|
|
unittest.TestCase):
|
|
|
|
encoding = 'euc_jisx0213'
|
|
|
|
mapfilename = 'EUC-JISX0213.TXT'
|
|
|
|
mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JISX0213.TXT'
|
|
|
|
|
|
|
|
|
2012-04-09 10:37:52 -03:00
|
|
|
class TestSJISX0213Map(multibytecodec_support.TestBase_Mapping,
|
2004-01-17 10:29:29 -04:00
|
|
|
unittest.TestCase):
|
|
|
|
encoding = 'shift_jisx0213'
|
|
|
|
mapfilename = 'SHIFT_JISX0213.TXT'
|
|
|
|
mapfileurl = 'http://people.freebsd.org/~perky/i18n/SHIFT_JISX0213.TXT'
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2014-07-01 21:55:04 -03:00
|
|
|
unittest.main()
|