tests/unicode.py | raw changeset files shortlog |
1.1 --- a/tests/unicode.py Thu Dec 15 01:40:31 2016 +0100 1.2 +++ b/tests/unicode.py Thu Dec 15 16:09:01 2016 +0100 1.3 @@ -37,6 +37,13 @@ 1.4 print u3.encoding # ISO-8859-1 1.5 print len(u3) # 3 1.6 1.7 +# Test invalid sequences. 1.8 + 1.9 +try: 1.10 + u4 = unicode(s, "UTF-8") 1.11 +except UnicodeDecodeError, exc: 1.12 + print "Attempt to decode", s, "as UTF-8 failed." 1.13 + 1.14 # Combine bytes and text. 1.15 # The text should be decoded. 1.16