1# 2# test_codecmaps_jp.py 3# Codec mapping tests for Japanese encodings 4# 5 6from test import test_support 7from test import test_multibytecodec_support 8import unittest 9 10class TestCP932Map(test_multibytecodec_support.TestBase_Mapping, 11 unittest.TestCase): 12 encoding = 'cp932' 13 mapfileurl = 'http://www.pythontest.net/unicode/CP932.TXT' 14 supmaps = [ 15 ('\x80', u'\u0080'), 16 ('\xa0', u'\uf8f0'), 17 ('\xfd', u'\uf8f1'), 18 ('\xfe', u'\uf8f2'), 19 ('\xff', u'\uf8f3'), 20 ] 21 for i in range(0xa1, 0xe0): 22 supmaps.append((chr(i), unichr(i+0xfec0))) 23 24 25class TestEUCJPCOMPATMap(test_multibytecodec_support.TestBase_Mapping, 26 unittest.TestCase): 27 encoding = 'euc_jp' 28 mapfilename = 'EUC-JP.TXT' 29 mapfileurl = 'http://www.pythontest.net/unicode/EUC-JP.TXT' 30 31 32class TestSJISCOMPATMap(test_multibytecodec_support.TestBase_Mapping, 33 unittest.TestCase): 34 encoding = 'shift_jis' 35 mapfilename = 'SHIFTJIS.TXT' 36 mapfileurl = 'http://www.pythontest.net/unicode/SHIFTJIS.TXT' 37 pass_enctest = [ 38 ('\x81_', u'\\'), 39 ] 40 pass_dectest = [ 41 ('\\', u'\xa5'), 42 ('~', u'\u203e'), 43 ('\x81_', u'\\'), 44 ] 45 46class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping, 47 unittest.TestCase): 48 encoding = 'euc_jisx0213' 49 mapfilename = 'EUC-JISX0213.TXT' 50 mapfileurl = 'http://www.pythontest.net/unicode/EUC-JISX0213.TXT' 51 52 53class TestSJISX0213Map(test_multibytecodec_support.TestBase_Mapping, 54 unittest.TestCase): 55 encoding = 'shift_jisx0213' 56 mapfilename = 'SHIFT_JISX0213.TXT' 57 mapfileurl = 'http://www.pythontest.net/unicode/SHIFT_JISX0213.TXT' 58 59 60def test_main(): 61 test_support.run_unittest(__name__) 62 63if __name__ == "__main__": 64 test_main() 65