diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-24 22:19:07 (GMT) | 
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-24 22:19:07 (GMT) | 
| commit | 9e5cdcc243b2f1830c8fb55efea10c5bb1ab186b (patch) | |
| tree | 6c5148a60a44b06f82bb1ef77efc567d079d4e3f /Lib/test/test_codecencodings_cn.py | |
| parent | b94e0cde60dbce9f99ecdd5e3846820c60a0f8bf (diff) | |
| download | cpython-9e5cdcc243b2f1830c8fb55efea10c5bb1ab186b.zip cpython-9e5cdcc243b2f1830c8fb55efea10c5bb1ab186b.tar.gz cpython-9e5cdcc243b2f1830c8fb55efea10c5bb1ab186b.tar.bz2 | |
Issue #12057: Add tests for the HZ encoding
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 96b0d77..215e8de 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', +         u'This sentence is in ASCII.\n' +         u'The next sentence is in GB.' +         u'\u5df1\u6240\u4e0d\u6b32\uff0c\u52ff\u65bd\u65bc\u4eba\u3002' +         u'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', +         u'This sentence is in ASCII.\n' +         u'The next sentence is in GB.' +         u'\u5df1\u6240\u4e0d\u6b32\uff0c\u52ff\u65bd\u65bc\u4eba\u3002' +         u'Bye.\n'), +        # invalid bytes +        (b'ab~cd', 'replace', u'ab\uFFFDd'), +        (b'ab\xffcd', 'replace', u'ab\uFFFDcd'), +        (b'ab~{\x81\x81\x41\x44~}cd', 'replace', u'ab\uFFFD\uFFFD\u804Acd'), +    ) +  def test_main():      test_support.run_unittest(__name__) | 
