summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ucn.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-01-19 11:00:42 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-01-19 11:00:42 (GMT)
commitee865c64da9892df7ebfe7863025e0122634e4ea (patch)
treed9df515862f1bdfe1d0826e684b058229a325132 /Lib/test/test_ucn.py
parentd5d2cd149f78ba990526096e62df9f380dacfc12 (diff)
downloadcpython-ee865c64da9892df7ebfe7863025e0122634e4ea.zip
cpython-ee865c64da9892df7ebfe7863025e0122634e4ea.tar.gz
cpython-ee865c64da9892df7ebfe7863025e0122634e4ea.tar.bz2
added "getcode" and "getname" methods to the ucnhash module (they're
probably more useful for the test code than for any applications, but one never knows...)
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r--Lib/test/test_ucn.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py
index a33d111..a51dc9a 100644
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -37,6 +37,23 @@ 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)
+
+import ucnhash
+
+# minimal sanity check
+for char in "SPAM":
+ name = "LATIN SMALL LETTER %s" % char
+ code = ucnhash.getcode(name)
+ verify(ucnhash.getname(code) == name)
+
+# loop over all characters in the database
+for code in range(65536):
+ try:
+ name = ucnhash.getname(code)
+ verify(ucnhash.getcode(name) == code)
+ except ValueError:
+ pass
+
print "done."
# misc. symbol testing