summaryrefslogtreecommitdiff
path: root/Lib/test/test_ucn.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-01-19 11:00:42 +0000
committerFredrik Lundh <fredrik@pythonware.com>2001-01-19 11:00:42 +0000
commit9593b0b52f0ed6d78d7b9c7e3d208b22bad3841d (patch)
tree0141f30715671807b2826466b3ef6e69d3a4969a /Lib/test/test_ucn.py
parent973107fd21debae1a49cb3526b587a517dfdd278 (diff)
downloadcpython-9593b0b52f0ed6d78d7b9c7e3d208b22bad3841d.tar.gz
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 a33d1114c6..a51dc9a72e 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