10a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#!/usr/bin/env python
20a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
30a8c90248264a8b26970b4473770bcc3df8515fJosh Gao# test_codecencodings_hk.py
40a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#   Codec encoding tests for HongKong encodings.
50a8c90248264a8b26970b4473770bcc3df8515fJosh Gao#
60a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
70a8c90248264a8b26970b4473770bcc3df8515fJosh Gaofrom test import test_support
80a8c90248264a8b26970b4473770bcc3df8515fJosh Gaofrom test import test_multibytecodec_support
90a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoimport unittest
100a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
110a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoclass Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase):
120a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    encoding = 'big5hkscs'
130a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    tstring = test_multibytecodec_support.load_teststring('big5hkscs')
140a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    codectests = (
150a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        # invalid bytes
160a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ("abc\x80\x80\xc1\xc4", "strict",  None),
170a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ("abc\xc8", "strict",  None),
180a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"),
190a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"),
200a8c90248264a8b26970b4473770bcc3df8515fJosh Gao        ("abc\x80\x80\xc1\xc4", "ignore",  u"abc\u8b10"),
210a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    )
220a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
230a8c90248264a8b26970b4473770bcc3df8515fJosh Gaodef test_main():
240a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    test_support.run_unittest(__name__)
250a8c90248264a8b26970b4473770bcc3df8515fJosh Gao
260a8c90248264a8b26970b4473770bcc3df8515fJosh Gaoif __name__ == "__main__":
270a8c90248264a8b26970b4473770bcc3df8515fJosh Gao    test_main()
28