示例#1
0
 def test_unicode_translate_error(self):
     from exceptions import UnicodeTranslateError
     ut = UnicodeTranslateError(u"x", 1, 5, "bah")
     assert ut.object == u'x'
     assert ut.start == 1
     assert ut.end == 5
     assert ut.reason == 'bah'
     assert ut.args == (u'x', 1, 5, 'bah')
     assert ut.message == ''
     ut.object = u'y'
     assert ut.object == u'y'
     assert str(ut) == "can't translate characters in position 1-4: bah"
     ut.start = 4
     ut.object = u'012345'
     assert str(ut) == "can't translate character u'\\x34' in position 4: bah"
     ut.object = []
     assert ut.object == []
示例#2
0
文件: test_exc.py 项目: Mu-L/pypy
 def test_unicode_translate_error(self):
     from exceptions import UnicodeTranslateError
     ut = UnicodeTranslateError(u"x", 1, 5, "bah")
     assert ut.object == u'x'
     assert ut.start == 1
     assert ut.end == 5
     assert ut.reason == 'bah'
     assert ut.args == (u'x', 1, 5, 'bah')
     assert ut.message == ''
     ut.object = u'y'
     assert ut.object == u'y'
     assert str(ut) == "can't translate characters in position 1-4: bah"
     ut.start = 4
     ut.object = u'012345'
     assert str(ut) == "can't translate character u'\\x34' in position 4: bah"
     ut.object = []
     assert ut.object == []
示例#3
0
文件: test_exc.py 项目: Mu-L/pypy
 def test_unicode_error_uninitialized_str(self):
     assert str(UnicodeEncodeError.__new__(UnicodeEncodeError)) == ""
     assert str(UnicodeDecodeError.__new__(UnicodeDecodeError)) == ""
     assert str(UnicodeTranslateError.__new__(UnicodeTranslateError)) == ""
示例#4
0
文件: test_exc.py 项目: Darriall/pypy
 def test_unicode_error_uninitialized_str(self):
     assert str(UnicodeEncodeError.__new__(UnicodeEncodeError)) == ""
     assert str(UnicodeDecodeError.__new__(UnicodeDecodeError)) == ""
     assert str(UnicodeTranslateError.__new__(UnicodeTranslateError)) == ""