summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2002-08-11 12:23:04 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2002-08-11 12:23:04 (GMT)
commitcc8764ca9dc3fceb9dc283163a89c9bb649b5392 (patch)
tree7f4c069636e05afe04482cc42c38f1937818806d /Lib/test
parent078151da901bebce6eb232d958fbbb1e5ced4399 (diff)
downloadcpython-cc8764ca9dc3fceb9dc283163a89c9bb649b5392.zip
cpython-cc8764ca9dc3fceb9dc283163a89c9bb649b5392.tar.gz
cpython-cc8764ca9dc3fceb9dc283163a89c9bb649b5392.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_unicode.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index a915b2e..f5f4245 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -453,6 +453,14 @@ except KeyError:
else:
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...')
verify('...%(foo)s...' % {'foo':"abc"} == '...abc...')