python/nondist/sandbox/parrotbench b5.py, 1.2, 1.3 out5, 1.3, 1.4

Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv23820 Modified Files: b5.py out5 Log Message: More fun with encode() and decode(). Index: b5.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b5.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b5.py 31 Dec 2003 06:16:46 -0000 1.2 --- b5.py 31 Dec 2003 06:43:47 -0000 1.3 *************** *** 175,183 **** check(unicode("abc"), u"abc") ! check(unicode("abc", "ascii"), u"abc") check(unicode("abc\xff", "Latin-1"), u"abc\u00ff") check(unicode("abc\xc3\xbf", "utf8"), u"abc\xff") ! exception(UnicodeError, unicode, "abc\xff", "ascii") ! exception(UnicodeError, unicode, "abc\xff", "utf-8") check(list(xrange(10)), range(10)) --- 175,195 ---- check(unicode("abc"), u"abc") ! check("abc".decode(), u"abc") ! check(unicode("abc", "ASCII"), u"abc") ! check("abc".decode("646"), u"abc") check(unicode("abc\xff", "Latin-1"), u"abc\u00ff") + check("abc\xff".decode("latin-1"), u"abc\u00ff") check(unicode("abc\xc3\xbf", "utf8"), u"abc\xff") ! check("abc\xc3\xbf".decode("Utf8"), u"abc\xff") ! exception(UnicodeError, unicode, "abc\xff") ! exception(UnicodeError, "abc\xff".decode) ! exception(UnicodeError, unicode, "abc\xff", "us_ascii") ! exception(UnicodeError, "abc\xff".decode, "Ascii") ! exception(UnicodeError, unicode, "abc\xff", "UTF-8") ! exception(UnicodeError, "abc\xff".decode, "utf8") ! check(u"abc\xff".encode("utf-8"), "abc\xc3\xbf") ! check(u"abc\xff".encode("latin1"), "abc\377") ! exception(UnicodeError, u"abc\xff".encode, "Ascii") ! check(u"abc".encode("us"), "abc") check(list(xrange(10)), range(10)) Index: out5 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out5,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** out5 31 Dec 2003 06:17:16 -0000 1.3 --- out5 31 Dec 2003 06:43:47 -0000 1.4 *************** *** 121,128 **** u'abc' == u'abc' u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' ! unicode('abc\xff', 'ascii') raised UnicodeError ! unicode('abc\xff', 'utf-8') raised UnicodeError [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')] --- 121,140 ---- u'abc' == u'abc' u'abc' == u'abc' + u'abc' == u'abc' + u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' ! u'abc\xff' == u'abc\xff' ! u'abc\xff' == u'abc\xff' ! unicode('abc\xff',) raised UnicodeError ! decode() raised UnicodeError ! unicode('abc\xff', 'us_ascii') raised UnicodeError ! decode('Ascii',) raised UnicodeError ! unicode('abc\xff', 'UTF-8') raised UnicodeError ! decode('utf8',) raised UnicodeError ! 'abc\xc3\xbf' == 'abc\xc3\xbf' ! 'abc\xff' == 'abc\xff' ! encode('Ascii',) raised UnicodeError ! 'abc' == 'abc' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')]
participants (1)
-
gvanrossumļ¼ users.sourceforge.net