[Python-checkins] python/dist/src/Lib/test test_unicode.py,1.64,1.65

lemburg@users.sourceforge.net lemburg@users.sourceforge.net
Sun, 11 Aug 2002 05:23:05 -0700


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

Modified Files:
	test_unicode.py 
Log Message:
Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.

u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.

Closes SF bug #593581.



Index: test_unicode.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** test_unicode.py	9 Aug 2002 15:36:48 -0000	1.64
--- test_unicode.py	11 Aug 2002 12:23:03 -0000	1.65
***************
*** 454,457 ****
--- 454,465 ----
      verify(value == u'abc, def')
  
+ for ordinal in (-100, 0x20000):
+     try:
+         u"%c" % ordinal
+     except ValueError:
+         pass
+     else:
+         print '*** formatting u"%%c" % %i should give a ValueError' % ordinal
+ 
  # formatting jobs delegated from the string implementation:
  verify('...%(foo)s...' % {'foo':u"abc"} == u'...abc...')