Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / lib / python2.4 / test / test_codecencodings_kr.py
CommitLineData
86530b38
AT
1#!/usr/bin/env python
2#
3# test_codecencodings_kr.py
4# Codec encoding tests for ROK encodings.
5#
6# $CJKCodecs: test_codecencodings_kr.py,v 1.2 2004/06/19 06:09:55 perky Exp $
7
8from test import test_support
9from test import test_multibytecodec_support
10import unittest
11
12class Test_CP949(test_multibytecodec_support.TestBase, unittest.TestCase):
13 encoding = 'cp949'
14 tstring = test_multibytecodec_support.load_teststring('cp949')
15 codectests = (
16 # invalid bytes
17 ("abc\x80\x80\xc1\xc4", "strict", None),
18 ("abc\xc8", "strict", None),
19 ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\uc894"),
20 ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\uc894\ufffd"),
21 ("abc\x80\x80\xc1\xc4", "ignore", u"abc\uc894"),
22 )
23
24class Test_EUCKR(test_multibytecodec_support.TestBase, unittest.TestCase):
25 encoding = 'euc_kr'
26 tstring = test_multibytecodec_support.load_teststring('euc_kr')
27 codectests = (
28 # invalid bytes
29 ("abc\x80\x80\xc1\xc4", "strict", None),
30 ("abc\xc8", "strict", None),
31 ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\uc894"),
32 ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\uc894\ufffd"),
33 ("abc\x80\x80\xc1\xc4", "ignore", u"abc\uc894"),
34 )
35
36class Test_JOHAB(test_multibytecodec_support.TestBase, unittest.TestCase):
37 encoding = 'johab'
38 tstring = test_multibytecodec_support.load_teststring('johab')
39 codectests = (
40 # invalid bytes
41 ("abc\x80\x80\xc1\xc4", "strict", None),
42 ("abc\xc8", "strict", None),
43 ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\ucd27"),
44 ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\ucd27\ufffd"),
45 ("abc\x80\x80\xc1\xc4", "ignore", u"abc\ucd27"),
46 )
47
48def test_main():
49 suite = unittest.TestSuite()
50 suite.addTest(unittest.makeSuite(Test_CP949))
51 suite.addTest(unittest.makeSuite(Test_EUCKR))
52 suite.addTest(unittest.makeSuite(Test_JOHAB))
53 test_support.run_suite(suite)
54
55if __name__ == "__main__":
56 test_main()