[Python-checkins] python/dist/src/Lib/test test_ucn.py,1.10,1.11
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Sat, 23 Nov 2002 10:01:33 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv18377/Lib/test
Modified Files:
test_ucn.py
Log Message:
Implement names for CJK unified ideographs. Add name to KeyError output.
Verify that the lookup for an existing name succeeds.
Index: test_ucn.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** test_ucn.py 23 Nov 2002 17:11:42 -0000 1.10
--- test_ucn.py 23 Nov 2002 18:01:30 -0000 1.11
***************
*** 81,94 ****
print "done."
! print "Testing code to name mapping for all characters....",
count = 0
! 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."
--- 81,106 ----
print "done."
! print "Testing names of CJK unified ideographs....",
! exec r"""
! verify(u"\N{CJK UNIFIED IDEOGRAPH-3400}" == u"\u3400")
! verify(u"\N{CJK UNIFIED IDEOGRAPH-4DB5}" == u"\u4db5")
! verify(u"\N{CJK UNIFIED IDEOGRAPH-4E00}" == u"\u4e00")
! verify(u"\N{CJK UNIFIED IDEOGRAPH-9FA5}" == u"\u9fa5")
! verify(u"\N{CJK UNIFIED IDEOGRAPH-20000}" == u"\U00020000")
! verify(u"\N{CJK UNIFIED IDEOGRAPH-2A6D6}" == u"\U0002a6d6")
! """
! print "done."
!
! print "Testing code to name mapping for all BMP characters....",
count = 0
! for code in range(0x10000):
try:
char = unichr(code)
name = unicodedata.name(char)
except (KeyError, ValueError):
pass
+ else:
+ verify(unicodedata.lookup(name) == char)
+ count += 1
print "done."