summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ucn.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-01-19 11:13:46 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-01-19 11:13:46 (GMT)
commit2acb54a19498925a88a030faa7071d9f08616ef8 (patch)
treeb8017c88c78f9e3ade470927819f868c76fe271e /Lib/test/test_ucn.py
parentee865c64da9892df7ebfe7863025e0122634e4ea (diff)
downloadcpython-2acb54a19498925a88a030faa7071d9f08616ef8.zip
cpython-2acb54a19498925a88a030faa7071d9f08616ef8.tar.gz
cpython-2acb54a19498925a88a030faa7071d9f08616ef8.tar.bz2
improved the ucnhash test a bit
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r--Lib/test/test_ucn.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py
index a51dc9a..f680140 100644
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -37,25 +37,30 @@ 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)
+print "done."
import ucnhash
-# minimal sanity check
+print "Testing name to code mapping....",
for char in "SPAM":
name = "LATIN SMALL LETTER %s" % char
code = ucnhash.getcode(name)
verify(ucnhash.getname(code) == name)
+print "done."
-# loop over all characters in the database
+print "Testing code to name mapping for all characters....",
+count = 0
for code in range(65536):
try:
name = ucnhash.getname(code)
verify(ucnhash.getcode(name) == code)
+ count += 1
except ValueError:
pass
-
print "done."
+print "Found", count, "characters in the unicode name database"
+
# misc. symbol testing
print "Testing misc. symbols for unicode character name expansion....",
verify(u"\N{PILCROW SIGN}" == u"\u00b6")