[Python-checkins] python/dist/src/Lib/test test_codeccallbacks.py,
1.12, 1.12.8.1
doerwalter at users.sourceforge.net
doerwalter at users.sourceforge.net
Tue Aug 12 11:38:24 EDT 2003
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv15853/Lib/test
Modified Files:
Tag: release23-maint
test_codeccallbacks.py
Log Message:
Backport checkins:
* Enhance message for UnicodeEncodeError and UnicodeTranslateError.
If there is only one bad character it will now be printed in a
form that is a valid Python string.
* Add a unicode prefix to the characters in the UnicodeEncodeError
and UnicodeTranslateError message.
Index: test_codeccallbacks.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v
retrieving revision 1.12
retrieving revision 1.12.8.1
diff -C2 -d -r1.12 -r1.12.8.1
*** test_codeccallbacks.py 1 May 2003 17:45:36 -0000 1.12
--- test_codeccallbacks.py 12 Aug 2003 17:38:22 -0000 1.12.8.1
***************
*** 259,263 ****
UnicodeEncodeError,
["ascii", u"g\xfcrk", 1, 2, "ouch"],
! "'ascii' codec can't encode character '\ufc' in position 1: ouch"
)
self.check_exceptionobjectargs(
--- 259,263 ----
UnicodeEncodeError,
["ascii", u"g\xfcrk", 1, 2, "ouch"],
! "'ascii' codec can't encode character u'\\xfc' in position 1: ouch"
)
self.check_exceptionobjectargs(
***************
*** 269,274 ****
UnicodeEncodeError,
["ascii", u"\xfcx", 0, 1, "ouch"],
! "'ascii' codec can't encode character '\ufc' in position 0: ouch"
)
def test_unicodedecodeerror(self):
--- 269,290 ----
UnicodeEncodeError,
["ascii", u"\xfcx", 0, 1, "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 u'\\u0100' in position 0: ouch"
)
+ self.check_exceptionobjectargs(
+ UnicodeEncodeError,
+ ["ascii", u"\uffffx", 0, 1, "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 u'\\U00010000' in position 0: ouch"
+ )
def test_unicodedecodeerror(self):
***************
*** 288,293 ****
UnicodeTranslateError,
[u"g\xfcrk", 1, 2, "ouch"],
! "can't translate character '\\ufc' in position 1: ouch"
)
self.check_exceptionobjectargs(
UnicodeTranslateError,
--- 304,325 ----
UnicodeTranslateError,
[u"g\xfcrk", 1, 2, "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 u'\\u0100' in position 1: ouch"
)
+ self.check_exceptionobjectargs(
+ UnicodeTranslateError,
+ [u"g\uffffrk", 1, 2, "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 u'\\U00010000' in position 1: ouch"
+ )
self.check_exceptionobjectargs(
UnicodeTranslateError,
More information about the Python-checkins
mailing list