Hye-Shik Chang | 2bb146f | 2004-07-18 03:06:29 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # test_codecencodings_hk.py |
| 4 | # Codec encoding tests for HongKong encodings. |
| 5 | # |
Hye-Shik Chang | 2bb146f | 2004-07-18 03:06:29 +0000 | [diff] [blame] | 6 | |
Benjamin Peterson | ee8712c | 2008-05-20 21:35:26 +0000 | [diff] [blame] | 7 | from test import support |
Hye-Shik Chang | 2bb146f | 2004-07-18 03:06:29 +0000 | [diff] [blame] | 8 | from test import test_multibytecodec_support |
| 9 | import unittest |
| 10 | |
| 11 | class Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase): |
| 12 | encoding = 'big5hkscs' |
| 13 | tstring = test_multibytecodec_support.load_teststring('big5hkscs') |
| 14 | codectests = ( |
| 15 | # invalid bytes |
Guido van Rossum | 024da5c | 2007-05-17 23:59:11 +0000 | [diff] [blame] | 16 | (b"abc\x80\x80\xc1\xc4", "strict", None), |
| 17 | (b"abc\xc8", "strict", None), |
| 18 | (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\u8b10"), |
| 19 | (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\u8b10\ufffd"), |
| 20 | (b"abc\x80\x80\xc1\xc4", "ignore", "abc\u8b10"), |
Hye-Shik Chang | 2bb146f | 2004-07-18 03:06:29 +0000 | [diff] [blame] | 21 | ) |
| 22 | |
| 23 | def test_main(): |
Benjamin Peterson | ee8712c | 2008-05-20 21:35:26 +0000 | [diff] [blame] | 24 | support.run_unittest(__name__) |
Hye-Shik Chang | 2bb146f | 2004-07-18 03:06:29 +0000 | [diff] [blame] | 25 | |
| 26 | if __name__ == "__main__": |
| 27 | test_main() |