diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2001-01-20 11:15:25 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2001-01-20 11:15:25 (GMT) |
commit | f60560626ce4fadf32fcbfac5e762242f661d508 (patch) | |
tree | a65aef32bd5ee544d593c3d4608dcd2d28f7efc2 /Lib/test/test_ucn.py | |
parent | ebb195b2703b25e0e2d12dcdc56c8c965caf02f7 (diff) | |
download | cpython-f60560626ce4fadf32fcbfac5e762242f661d508.zip cpython-f60560626ce4fadf32fcbfac5e762242f661d508.tar.gz cpython-f60560626ce4fadf32fcbfac5e762242f661d508.tar.bz2 |
Better error message if ucnhash cannot be found (obscure attribute
errors aren't that helpful), or doesn't contain what's expected from
it. Also tweaked the test script so it compiles even if ucnhash is
missing.
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r-- | Lib/test/test_ucn.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py index f680140..0797f2c 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -10,6 +10,10 @@ from test_support import verify, verbose print 'Testing General Unicode Character Name, and case insensitivity...', # General and case insensitivity test: +try: + # put all \N escapes inside exec'd raw strings, to make sure this + # script runs even if the compiler chokes on \N escapes + exec r""" s = u"\N{LATIN CAPITAL LETTER T}" \ u"\N{LATIN SMALL LETTER H}" \ u"\N{LATIN SMALL LETTER E}" \ @@ -37,6 +41,9 @@ s = u"\N{LATIN CAPITAL LETTER T}" \ u"\N{LATIN SMALL LETTER P}" \ u"\N{FULL STOP}" verify(s == u"The rEd fOx ate the sheep.", s) +""" +except UnicodeError, v: + print v print "done." import ucnhash @@ -63,10 +70,12 @@ print "Found", count, "characters in the unicode name database" # misc. symbol testing print "Testing misc. symbols for unicode character name expansion....", +exec r""" verify(u"\N{PILCROW SIGN}" == u"\u00b6") verify(u"\N{REPLACEMENT CHARACTER}" == u"\uFFFD") verify(u"\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}" == u"\uFF9F") verify(u"\N{FULLWIDTH LATIN SMALL LETTER A}" == u"\uFF41") +""" print "done." |