0001 #!/usr/bin/env python 0002 # 0003 # test_codecmaps_jp.py 0004 # Codec mapping tests for Japanese encodings 0005 # 0006 # $CJKCodecs: test_codecmaps_jp.py,v 1.3 2004/06/19 06:09:55 perky Exp $ 0007 0008 from test import test_support 0009 from test import test_multibytecodec_support 0010 import unittest 0011 0012 class TestCP932Map(test_multibytecodec_support.TestBase_Mapping, 0013 unittest.TestCase): 0014 encoding = 'cp932' 0015 mapfilename = 'CP932.TXT' 0016 mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ 0017 'WINDOWS/CP932.TXT' 0018 supmaps = [ 0019 ('\x80', u'\u0080'), 0020 ('\xa0', u'\uf8f0'), 0021 ('\xfd', u'\uf8f1'), 0022 ('\xfe', u'\uf8f2'), 0023 ('\xff', u'\uf8f3'), 0024 ] 0025 for i in range(0xa1, 0xe0): 0026 supmaps.append((chr(i), unichr(i+0xfec0))) 0027 0028 0029 class TestEUCJPCOMPATMap(test_multibytecodec_support.TestBase_Mapping, 0030 unittest.TestCase): 0031 encoding = 'euc_jp' 0032 mapfilename = 'EUC-JP.TXT' 0033 mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JP.TXT' 0034 0035 0036 class TestSJISCOMPATMap(test_multibytecodec_support.TestBase_Mapping, 0037 unittest.TestCase): 0038 encoding = 'shift_jis' 0039 mapfilename = 'SHIFTJIS.TXT' 0040 mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \ 0041 '/EASTASIA/JIS/SHIFTJIS.TXT' 0042 pass_enctest = [ 0043 ('\x81_', u'\\'), 0044 ] 0045 pass_dectest = [ 0046 ('\\', u'\xa5'), 0047 ('~', u'\u203e'), 0048 ('\x81_', u'\\'), 0049 ] 0050 0051 class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping, 0052 unittest.TestCase): 0053 encoding = 'euc_jisx0213' 0054 mapfilename = 'EUC-JISX0213.TXT' 0055 mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JISX0213.TXT' 0056 0057 0058 class TestSJISX0213Map(test_multibytecodec_support.TestBase_Mapping, 0059 unittest.TestCase): 0060 encoding = 'shift_jisx0213' 0061 mapfilename = 'SHIFT_JISX0213.TXT' 0062 mapfileurl = 'http://people.freebsd.org/~perky/i18n/SHIFT_JISX0213.TXT' 0063 0064 0065 def test_main(): 0066 suite = unittest.TestSuite() 0067 suite.addTest(unittest.makeSuite(TestCP932Map)) 0068 suite.addTest(unittest.makeSuite(TestEUCJPCOMPATMap)) 0069 suite.addTest(unittest.makeSuite(TestSJISCOMPATMap)) 0070 suite.addTest(unittest.makeSuite(TestEUCJISX0213Map)) 0071 suite.addTest(unittest.makeSuite(TestSJISX0213Map)) 0072 test_support.run_suite(suite) 0073 0074 test_multibytecodec_support.register_skip_expected(TestCP932Map, 0075 TestEUCJPCOMPATMap, TestSJISCOMPATMap, TestEUCJISX0213Map, 0076 TestSJISX0213Map) 0077 0078 if __name__ == "__main__": 0079 test_main() 0080
Generated by PyXR 0.9.4