• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# test_codecencodings_hk.py
3#   Codec encoding tests for HongKong encodings.
4#
5
6from test import test_support
7from test import multibytecodec_support
8import unittest
9
10class Test_Big5HKSCS(multibytecodec_support.TestBase, unittest.TestCase):
11    encoding = 'big5hkscs'
12    tstring = multibytecodec_support.load_teststring('big5hkscs')
13    codectests = (
14        # invalid bytes
15        ("abc\x80\x80\xc1\xc4", "strict",  None),
16        ("abc\xc8", "strict",  None),
17        ("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u8b10"),
18        ("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u8b10\ufffd"),
19        ("abc\x80\x80\xc1\xc4", "ignore",  u"abc\u8b10"),
20    )
21
22def test_main():
23    test_support.run_unittest(__name__)
24
25if __name__ == "__main__":
26    test_main()
27