Change formatchar(), so that u"%c" % 0xffffffff now raises

an OverflowError instead of a TypeError to be consistent
with "%c" % 256. See SF patch #710127.
This commit is contained in:
Walter Dörwald 2003-04-02 16:37:24 +00:00
parent 7ba256f039
commit 44f527fea4
3 changed files with 5 additions and 4 deletions

View file

@ -360,7 +360,7 @@ class UnicodeTest(
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,))
self.assertRaises(OverflowError, u"%c".__mod__, (sys.maxunicode+1,))
# formatting jobs delegated from the string implementation:
self.assertEqual('...%(foo)s...' % {'foo':u"abc"}, u'...abc...')