summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-03-31 18:07:50 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-03-31 18:07:50 (GMT)
commit43440a621e022fbeaff24f84dcf4d5458601fedc (patch)
tree4ffebf718b3a2fef2e38d3b441975b30dde80ea6 /Lib/test/test_unicode.py
parent2a04623ddd8c15a1d559440a5f4a63d43a3cafd7 (diff)
downloadcpython-43440a621e022fbeaff24f84dcf4d5458601fedc.zip
cpython-43440a621e022fbeaff24f84dcf4d5458601fedc.tar.gz
cpython-43440a621e022fbeaff24f84dcf4d5458601fedc.tar.bz2
Fix PyString_Format() so that '%c' % u'a' returns u'a'
instead of raising a TypeError. (From SF patch #710127) Add tests to verify this is fixed. Add various tests for '%c' % int.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 43e2eba..69f308e 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -358,6 +358,8 @@ class UnicodeTest(
self.assertEqual(u"%r, %r" % (u"abc", "abc"), u"u'abc', 'abc'")
self.assertEqual(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"}, u'abc, def')
self.assertEqual(u"%(x)s, %(\xfc)s" % {'x':u"abc", u'\xfc':"def"}, u'abc, def')
+ self.assertEqual(u'%c' % 0x1234, u'\u1234')
+ self.assertRaises(ValueError, u'%c'.__mod__, sys.maxunicode+1)
# formatting jobs delegated from the string implementation:
self.assertEqual('...%(foo)s...' % {'foo':u"abc"}, u'...abc...')
@@ -375,6 +377,7 @@ class UnicodeTest(
self.assertEqual('%*.*s' % (5,3,u'abc',), u' abc')
self.assertEqual('%i %*.*s' % (10, 5,3,u'abc',), u'10 abc')
self.assertEqual('%i%s %*.*s' % (10, 3, 5, 3, u'abc',), u'103 abc')
+ self.assertEqual('%c' % u'a', u'a')
self.assertRaises(ValueError, u"%c".__mod__, (sys.maxunicode+1,))