3 # test_codecencodings_kr.py
4 # Codec encoding tests for ROK encodings.
7 from test
import test_support
8 from test
import test_multibytecodec_support
11 class Test_CP949(test_multibytecodec_support
.TestBase
, unittest
.TestCase
):
13 tstring
= test_multibytecodec_support
.load_teststring('cp949')
16 ("abc\x80\x80\xc1\xc4", "strict", None),
17 ("abc\xc8", "strict", None),
18 ("abc\x80\x80\xc1\xc4", "replace", u
"abc\ufffd\uc894"),
19 ("abc\x80\x80\xc1\xc4\xc8", "replace", u
"abc\ufffd\uc894\ufffd"),
20 ("abc\x80\x80\xc1\xc4", "ignore", u
"abc\uc894"),
23 class Test_EUCKR(test_multibytecodec_support
.TestBase
, unittest
.TestCase
):
25 tstring
= test_multibytecodec_support
.load_teststring('euc_kr')
28 ("abc\x80\x80\xc1\xc4", "strict", None),
29 ("abc\xc8", "strict", None),
30 ("abc\x80\x80\xc1\xc4", "replace", u
"abc\ufffd\uc894"),
31 ("abc\x80\x80\xc1\xc4\xc8", "replace", u
"abc\ufffd\uc894\ufffd"),
32 ("abc\x80\x80\xc1\xc4", "ignore", u
"abc\uc894"),
34 # composed make-up sequence errors
35 ("\xa4\xd4", "strict", None),
36 ("\xa4\xd4\xa4", "strict", None),
37 ("\xa4\xd4\xa4\xb6", "strict", None),
38 ("\xa4\xd4\xa4\xb6\xa4", "strict", None),
39 ("\xa4\xd4\xa4\xb6\xa4\xd0", "strict", None),
40 ("\xa4\xd4\xa4\xb6\xa4\xd0\xa4", "strict", None),
41 ("\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4", "strict", u
"\uc4d4"),
42 ("\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xd4x", "strict", u
"\uc4d4x"),
43 ("a\xa4\xd4\xa4\xb6\xa4", "replace", u
"a\ufffd"),
44 ("\xa4\xd4\xa3\xb6\xa4\xd0\xa4\xd4", "strict", None),
45 ("\xa4\xd4\xa4\xb6\xa3\xd0\xa4\xd4", "strict", None),
46 ("\xa4\xd4\xa4\xb6\xa4\xd0\xa3\xd4", "strict", None),
47 ("\xa4\xd4\xa4\xff\xa4\xd0\xa4\xd4", "replace", u
"\ufffd"),
48 ("\xa4\xd4\xa4\xb6\xa4\xff\xa4\xd4", "replace", u
"\ufffd"),
49 ("\xa4\xd4\xa4\xb6\xa4\xd0\xa4\xff", "replace", u
"\ufffd"),
50 ("\xc1\xc4", "strict", u
"\uc894"),
53 class Test_JOHAB(test_multibytecodec_support
.TestBase
, unittest
.TestCase
):
55 tstring
= test_multibytecodec_support
.load_teststring('johab')
58 ("abc\x80\x80\xc1\xc4", "strict", None),
59 ("abc\xc8", "strict", None),
60 ("abc\x80\x80\xc1\xc4", "replace", u
"abc\ufffd\ucd27"),
61 ("abc\x80\x80\xc1\xc4\xc8", "replace", u
"abc\ufffd\ucd27\ufffd"),
62 ("abc\x80\x80\xc1\xc4", "ignore", u
"abc\ucd27"),
66 test_support
.run_unittest(__name__
)
68 if __name__
== "__main__":