A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-checkins/2002-October/030024.html below:

[Python-checkins] python/dist/src/Lib/test test_unicode.py,1.47.6.6,1.47.6.7

[Python-checkins] python/dist/src/Lib/test test_unicode.py,1.47.6.6,1.47.6.7mwh@users.sourceforge.net mwh@users.sourceforge.net
Mon, 07 Oct 2002 05:32:58 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv32278/Lib/test

Modified Files:
      Tag: release22-maint
	test_unicode.py 
Log Message:
Backport:

2002/08/11 12:23:04 lemburg Python/bltinmodule.c 2.262
2002/08/11 12:23:04 lemburg Objects/unicodeobject.c 2.162
2002/08/11 12:23:03 lemburg Misc/NEWS 1.461
2002/08/11 12:23:03 lemburg Lib/test/test_unicode.py 1.65
2002/08/11 12:23:03 lemburg Include/unicodeobject.h 2.39
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.47.6.6
retrieving revision 1.47.6.7
diff -C2 -d -r1.47.6.6 -r1.47.6.7
*** test_unicode.py	24 Sep 2002 14:06:55 -0000	1.47.6.6
--- test_unicode.py	7 Oct 2002 12:32:56 -0000	1.47.6.7
***************
*** 443,446 ****
--- 443,454 ----
      verify(value == u'abc, def')
  
+ for ordinal in (-100, 0x200000):
+     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...')
***************
*** 737,740 ****
--- 745,756 ----
      except ValueError,why:
          print '*** codec for "%s" failed: %s' % (encoding, why)
+ 
+ # UTF-8 must be roundtrip safe for all UCS-2 code points
+ # This excludes surrogates: in the full range, there would be
+ # a surrogate pair (\udbff\udc00), which gets converted back
+ # to a non-BMP character (\U0010fc00)
+ u = u''.join(map(unichr, range(0,0xd800)+range(0xe000,0x10000)))
+ for encoding in ('utf-8',):
+     verify(unicode(u.encode(encoding),encoding) == u)
  
  print 'done.'





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4