[Python-checkins] CVS: python/dist/src/Lib/test test_ucn.py,1.4,1.5

Fredrik Lundh effbot@users.sourceforge.net
Fri, 19 Jan 2001 03:00:44 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv10825/Lib/test

Modified Files:
	test_ucn.py 
Log Message:


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...)


Index: test_ucn.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_ucn.py	2001/01/19 09:45:02	1.4
--- test_ucn.py	2001/01/19 11:00:42	1.5
***************
*** 38,41 ****
--- 38,58 ----
      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."