Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | #!/usr/bin/env python |
2 | # | |
3 | # test_codecencodings_tw.py | |
4 | # Codec encoding tests for ROC encodings. | |
5 | # | |
6 | # $CJKCodecs: test_codecencodings_tw.py,v 1.2 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 Test_Big5(test_multibytecodec_support.TestBase, unittest.TestCase): | |
13 | encoding = 'big5' | |
14 | tstring = test_multibytecodec_support.load_teststring('big5') | |
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\u8b10"), | |
20 | ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"), | |
21 | ("abc\x80\x80\xc1\xc4", "ignore", u"abc\u8b10"), | |
22 | ) | |
23 | ||
24 | def test_main(): | |
25 | suite = unittest.TestSuite() | |
26 | suite.addTest(unittest.makeSuite(Test_Big5)) | |
27 | test_support.run_suite(suite) | |
28 | ||
29 | if __name__ == "__main__": | |
30 | test_main() |