From: Michael W. Hudson Date: Mon, 18 Mar 2002 12:54:51 +0000 (+0000) Subject: doerwalter's failing examples from X-Git-Tag: v2.2.1c1~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=724374d1626ba1ffa300f244ccbdf0052ffd5701;p=thirdparty%2FPython%2Fcpython.git doerwalter's failing examples from [ 529104 ] broken error handling in unicode-escape --- diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 8d4bed564741..df5d6159ba0b 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -539,6 +539,14 @@ else: verify(unicode('Andr\202 x','ascii','ignore') == u"Andr x") verify(unicode('Andr\202 x','ascii','replace') == u'Andr\uFFFD x') +verify("\\N{foo}xx".decode("unicode-escape", "ignore") == u"xx") +try: + "\\".decode("unicode-escape") +except ValueError: + pass +else: + raise TestFailed, '"\\".decode("unicode-escape") should fail' + verify(u'hello'.encode('ascii') == 'hello') verify(u'hello'.encode('utf-7') == 'hello') verify(u'hello'.encode('utf-8') == 'hello')