| 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # test_codecmaps_kr.py |
| 4 | # Codec mapping tests for ROK encodings |
| 5 | # |
| 6 | # $CJKCodecs: test_codecmaps_kr.py,v 1.3 2004/06/19 06:09:55 perky Exp $ |
| 7 | |
| 8 | from test import test_support |
| 9 | from test import test_multibytecodec_support |
| 10 | import unittest |
| 11 | |
| 12 | class TestCP949Map(test_multibytecodec_support.TestBase_Mapping, |
| 13 | unittest.TestCase): |
| 14 | encoding = 'cp949' |
| 15 | mapfilename = 'CP949.TXT' |
| 16 | mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT' \ |
| 17 | '/WINDOWS/CP949.TXT' |
| 18 | |
| 19 | |
| 20 | class TestEUCKRMap(test_multibytecodec_support.TestBase_Mapping, |
| 21 | unittest.TestCase): |
| 22 | encoding = 'euc_kr' |
| 23 | mapfilename = 'EUC-KR.TXT' |
| 24 | mapfileurl = 'http://people.freebsd.org/~perky/i18n/EUC-KR.TXT' |
| 25 | |
| 26 | |
| 27 | class TestJOHABMap(test_multibytecodec_support.TestBase_Mapping, |
| 28 | unittest.TestCase): |
| 29 | encoding = 'johab' |
| 30 | mapfilename = 'JOHAB.TXT' |
| 31 | mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/' \ |
| 32 | 'KSC/JOHAB.TXT' |
| 33 | # KS X 1001 standard assigned 0x5c as WON SIGN. |
| 34 | # but, in early 90s that is the only era used johab widely, |
| 35 | # the most softwares implements it as REVERSE SOLIDUS. |
| 36 | # So, we ignore the standard here. |
| 37 | pass_enctest = [('\\', u'\u20a9')] |
| 38 | pass_dectest = [('\\', u'\u20a9')] |
| 39 | |
| 40 | def test_main(): |
| 41 | suite = unittest.TestSuite() |
| 42 | suite.addTest(unittest.makeSuite(TestCP949Map)) |
| 43 | suite.addTest(unittest.makeSuite(TestEUCKRMap)) |
| 44 | suite.addTest(unittest.makeSuite(TestJOHABMap)) |
| 45 | test_support.run_suite(suite) |
| 46 | |
| 47 | test_multibytecodec_support.register_skip_expected(TestCP949Map, |
| 48 | TestEUCKRMap, TestJOHABMap) |
| 49 | if __name__ == "__main__": |
| 50 | test_main() |