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

Fredrik Lundh effbot@users.sourceforge.net
Tue, 23 Jan 2001 23:59:13 -0800


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

Modified Files:
	test_ucn.py 
Log Message:


Move uchhash functionality into unicodedata (after the recent
crop of changes, the files are small enough to do this).  Also
adds "name" and "lookup" functions to unicodedata.


Index: test_ucn.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_ucn.py	2001/01/20 11:15:25	1.7
--- test_ucn.py	2001/01/24 07:59:11	1.8
***************
*** 2,5 ****
--- 2,6 ----
  
  Written by Bill Tutt.
+ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
  
  (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
***************
*** 47,57 ****
  print "done."
  
! import ucnhash
  
  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."
  
--- 48,58 ----
  print "done."
  
! import unicodedata
  
  print "Testing name to code mapping....",
  for char in "SPAM":
      name = "LATIN SMALL LETTER %s" % char
!     code = unicodedata.lookup(name)
!     verify(unicodedata.name(code) == name)
  print "done."
  
***************
*** 60,67 ****
  for code in range(65536):
      try:
!         name = ucnhash.getname(code)
!         verify(ucnhash.getcode(name) == code)
          count += 1
!     except ValueError:
          pass
  print "done."
--- 61,69 ----
  for code in range(65536):
      try:
!         char = unichr(code)
!         name = unicodedata.name(char)
!         verify(unicodedata.lookup(name) == char)
          count += 1
!     except (KeyError, ValueError):
          pass
  print "done."
***************
*** 78,82 ****
  """
  print "done."
- 
  
  # strict error testing:
--- 80,83 ----