File: test_codecencodings_tw.py

package info (click to toggle)
python3.4 3.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 80,356 kB
  • ctags: 100,540
  • sloc: python: 459,698; ansic: 381,519; sh: 17,599; asm: 14,322; makefile: 2,209; objc: 761; lisp: 502; exp: 499; cpp: 353; pascal: 80; xml: 73; csh: 21
file content (26 lines) | stat: -rw-r--r-- 755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# test_codecencodings_tw.py
#   Codec encoding tests for ROC encodings.
#

from test import support
from test import multibytecodec_support
import unittest

class Test_Big5(multibytecodec_support.TestBase, unittest.TestCase):
    encoding = 'big5'
    tstring = multibytecodec_support.load_teststring('big5')
    codectests = (
        # invalid bytes
        (b"abc\x80\x80\xc1\xc4", "strict",  None),
        (b"abc\xc8", "strict",  None),
        (b"abc\x80\x80\xc1\xc4", "replace", "abc\ufffd\ufffd\u8b10"),
        (b"abc\x80\x80\xc1\xc4\xc8", "replace", "abc\ufffd\ufffd\u8b10\ufffd"),
        (b"abc\x80\x80\xc1\xc4", "ignore",  "abc\u8b10"),
    )

def test_main():
    support.run_unittest(__name__)

if __name__ == "__main__":
    test_main()