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