mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Add a unicode prefix to the characters in the UnicodeEncodeError and
UnicodeTranslateError message.
This commit is contained in:
parent
fd196bd263
commit
a54b92b2eb
2 changed files with 15 additions and 15 deletions
|
@ -258,7 +258,7 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
self.check_exceptionobjectargs(
|
||||
UnicodeEncodeError,
|
||||
["ascii", u"g\xfcrk", 1, 2, "ouch"],
|
||||
"'ascii' codec can't encode character '\\xfc' in position 1: ouch"
|
||||
"'ascii' codec can't encode character u'\\xfc' in position 1: ouch"
|
||||
)
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeEncodeError,
|
||||
|
@ -268,23 +268,23 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
self.check_exceptionobjectargs(
|
||||
UnicodeEncodeError,
|
||||
["ascii", u"\xfcx", 0, 1, "ouch"],
|
||||
"'ascii' codec can't encode character '\\xfc' in position 0: ouch"
|
||||
"'ascii' codec can't encode character u'\\xfc' in position 0: ouch"
|
||||
)
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeEncodeError,
|
||||
["ascii", u"\u0100x", 0, 1, "ouch"],
|
||||
"'ascii' codec can't encode character '\\u0100' in position 0: ouch"
|
||||
"'ascii' codec can't encode character u'\\u0100' in position 0: ouch"
|
||||
)
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeEncodeError,
|
||||
["ascii", u"\uffffx", 0, 1, "ouch"],
|
||||
"'ascii' codec can't encode character '\\uffff' in position 0: ouch"
|
||||
"'ascii' codec can't encode character u'\\uffff' in position 0: ouch"
|
||||
)
|
||||
if sys.maxunicode > 0xffff:
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeEncodeError,
|
||||
["ascii", u"\U00010000x", 0, 1, "ouch"],
|
||||
"'ascii' codec can't encode character '\\U00010000' in position 0: ouch"
|
||||
"'ascii' codec can't encode character u'\\U00010000' in position 0: ouch"
|
||||
)
|
||||
|
||||
def test_unicodedecodeerror(self):
|
||||
|
@ -303,23 +303,23 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
self.check_exceptionobjectargs(
|
||||
UnicodeTranslateError,
|
||||
[u"g\xfcrk", 1, 2, "ouch"],
|
||||
"can't translate character '\\xfc' in position 1: ouch"
|
||||
"can't translate character u'\\xfc' in position 1: ouch"
|
||||
)
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeTranslateError,
|
||||
[u"g\u0100rk", 1, 2, "ouch"],
|
||||
"can't translate character '\\u0100' in position 1: ouch"
|
||||
"can't translate character u'\\u0100' in position 1: ouch"
|
||||
)
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeTranslateError,
|
||||
[u"g\uffffrk", 1, 2, "ouch"],
|
||||
"can't translate character '\\uffff' in position 1: ouch"
|
||||
"can't translate character u'\\uffff' in position 1: ouch"
|
||||
)
|
||||
if sys.maxunicode > 0xffff:
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeTranslateError,
|
||||
[u"g\U00010000rk", 1, 2, "ouch"],
|
||||
"can't translate character '\\U00010000' in position 1: ouch"
|
||||
"can't translate character u'\\U00010000' in position 1: ouch"
|
||||
)
|
||||
self.check_exceptionobjectargs(
|
||||
UnicodeTranslateError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue