test_codecencodings_hk.py 701 Bytes
Newer Older
1 2 3 4 5
#
# test_codecencodings_hk.py
#   Codec encoding tests for HongKong encodings.
#

6
from test import multibytecodec_support
7 8
import unittest

9
class Test_Big5HKSCS(multibytecodec_support.TestBase, unittest.TestCase):
10
    encoding = 'big5hkscs'
11
    tstring = multibytecodec_support.load_teststring('big5hkscs')
12 13
    codectests = (
        # invalid bytes
14 15
        (b"abc\x80\x80\xc1\xc4", "strict",  None),
        (b"abc\xc8", "strict",  None),
16 17
        (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u8b10"),
        (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u8b10\ufffd"),
18
        (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\u8b10"),
19 20 21
    )

if __name__ == "__main__":
22
    unittest.main()