move sections
[python/dscho.git] / Lib / test / test_codecmaps_jp.py
blob5466a986b9d32c889c0060bcaba932ddc68bdda9
1 #!/usr/bin/env python
3 # test_codecmaps_jp.py
4 # Codec mapping tests for Japanese encodings
7 from test import test_support
8 from test import test_multibytecodec_support
9 import unittest
11 class TestCP932Map(test_multibytecodec_support.TestBase_Mapping,
12 unittest.TestCase):
13 encoding = 'cp932'
14 mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \
15 'WINDOWS/CP932.TXT'
16 supmaps = [
17 ('\x80', u'\u0080'),
18 ('\xa0', u'\uf8f0'),
19 ('\xfd', u'\uf8f1'),
20 ('\xfe', u'\uf8f2'),
21 ('\xff', u'\uf8f3'),
23 for i in range(0xa1, 0xe0):
24 supmaps.append((chr(i), unichr(i+0xfec0)))
27 class TestEUCJPCOMPATMap(test_multibytecodec_support.TestBase_Mapping,
28 unittest.TestCase):
29 encoding = 'euc_jp'
30 mapfilename = 'EUC-JP.TXT'
31 mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JP.TXT'
34 class TestSJISCOMPATMap(test_multibytecodec_support.TestBase_Mapping,
35 unittest.TestCase):
36 encoding = 'shift_jis'
37 mapfilename = 'SHIFTJIS.TXT'
38 mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE' \
39 '/EASTASIA/JIS/SHIFTJIS.TXT'
40 pass_enctest = [
41 ('\x81_', u'\\'),
43 pass_dectest = [
44 ('\\', u'\xa5'),
45 ('~', u'\u203e'),
46 ('\x81_', u'\\'),
49 class TestEUCJISX0213Map(test_multibytecodec_support.TestBase_Mapping,
50 unittest.TestCase):
51 encoding = 'euc_jisx0213'
52 mapfilename = 'EUC-JISX0213.TXT'
53 mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-JISX0213.TXT'
56 class TestSJISX0213Map(test_multibytecodec_support.TestBase_Mapping,
57 unittest.TestCase):
58 encoding = 'shift_jisx0213'
59 mapfilename = 'SHIFT_JISX0213.TXT'
60 mapfileurl = 'http://people.freebsd.org/~perky/i18n/SHIFT_JISX0213.TXT'
63 def test_main():
64 test_support.run_unittest(__name__)
66 if __name__ == "__main__":
67 test_main()