diff options
author | Gregory P. Smith <greg@krypto.org> | 2011-06-05 06:05:19 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2011-06-05 06:05:19 (GMT) |
commit | d64b2bae9b4d1b761cd16f75e3fe3e9c19533b3e (patch) | |
tree | cac5baf3e31b67e39cb9b69d982958cc9419db06 /Lib/test/test_codecencodings_cn.py | |
parent | b6471db8a76416b2eb49fe9b02c6f9f9a6502b4d (diff) | |
parent | e13e662244b4915e933eb2c84bc50705f99f5c4a (diff) | |
download | cpython-d64b2bae9b4d1b761cd16f75e3fe3e9c19533b3e.zip cpython-d64b2bae9b4d1b761cd16f75e3fe3e9c19533b3e.tar.gz cpython-d64b2bae9b4d1b761cd16f75e3fe3e9c19533b3e.tar.bz2 |
merge heads.
Diffstat (limited to 'Lib/test/test_codecencodings_cn.py')
-rw-r--r-- | Lib/test/test_codecencodings_cn.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py index a2d9718..dca9f10 100644 --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -50,6 +50,35 @@ class Test_GB18030(test_multibytecodec_support.TestBase, unittest.TestCase): ) has_iso10646 = True +class Test_HZ(test_multibytecodec_support.TestBase, unittest.TestCase): + encoding = 'hz' + tstring = test_multibytecodec_support.load_teststring('hz') + codectests = ( + # test '~\n' (3 lines) + (b'This sentence is in ASCII.\n' + b'The next sentence is in GB.~{<:Ky2;S{#,~}~\n' + b'~{NpJ)l6HK!#~}Bye.\n', + 'strict', + 'This sentence is in ASCII.\n' + 'The next sentence is in GB.' + '\u5df1\u6240\u4e0d\u6b32\uff0c\u52ff\u65bd\u65bc\u4eba\u3002' + 'Bye.\n'), + # test '~\n' (4 lines) + (b'This sentence is in ASCII.\n' + b'The next sentence is in GB.~\n' + b'~{<:Ky2;S{#,NpJ)l6HK!#~}~\n' + b'Bye.\n', + 'strict', + 'This sentence is in ASCII.\n' + 'The next sentence is in GB.' + '\u5df1\u6240\u4e0d\u6b32\uff0c\u52ff\u65bd\u65bc\u4eba\u3002' + 'Bye.\n'), + # invalid bytes + (b'ab~cd', 'replace', 'ab\uFFFDd'), + (b'ab\xffcd', 'replace', 'ab\uFFFDcd'), + (b'ab~{\x81\x81\x41\x44~}cd', 'replace', 'ab\uFFFD\uFFFD\u804Acd'), + ) + def test_main(): support.run_unittest(__name__) |