summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2017-05-22 17:02:33 (GMT)
committerGitHub <noreply@github.com>2017-05-22 17:02:33 (GMT)
commit65440f8278351e16350be716dff61f5f786f7060 (patch)
treeff5138ba2aec3c0cdd052399c14577004a2fda1a /Lib/test
parentbc75b72d393bc40c3243d7099db6c2c39fe632aa (diff)
downloadcpython-65440f8278351e16350be716dff61f5f786f7060.zip
cpython-65440f8278351e16350be716dff61f5f786f7060.tar.gz
cpython-65440f8278351e16350be716dff61f5f786f7060.tar.bz2
bpo-30003: Fix handling escape characters in HZ codec (#1556) (#1718)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_codecencodings_cn.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py
index f135bb2..5101b5c 100644
--- a/Lib/test/test_codecencodings_cn.py
+++ b/Lib/test/test_codecencodings_cn.py
@@ -87,6 +87,10 @@ class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase):
(b'ab~{\x81\x81\x41\x44~}cd', 'replace', 'ab\uFFFD\uFFFD\u804Acd'),
(b'ab~{\x41\x44~}cd', 'replace', 'ab\u804Acd'),
(b"ab~{\x79\x79\x41\x44~}cd", "replace", "ab\ufffd\ufffd\u804acd"),
+ # issue 30003
+ ('ab~cd', 'strict', b'ab~~cd'), # escape ~
+ (b'~{Dc~~:C~}', 'strict', None), # ~~ only in ASCII mode
+ (b'~{Dc~\n:C~}', 'strict', None), # ~\n only in ASCII mode
)
if __name__ == "__main__":