mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #3280: like chr() already does, the "%c" format now accepts the full unicode range
even on "narrow Unicode" builds; the result is a pair of UTF-16 surrogates.
This commit is contained in:
parent
142957ce95
commit
a4db68622c
4 changed files with 43 additions and 27 deletions
|
@ -717,7 +717,10 @@ class UnicodeTest(
|
|||
self.assertEqual("%(x)s, %(\xfc)s" % {'x':"abc", '\xfc':"def"}, 'abc, def')
|
||||
|
||||
self.assertEqual('%c' % 0x1234, '\u1234')
|
||||
self.assertRaises(OverflowError, "%c".__mod__, (sys.maxunicode+1,))
|
||||
self.assertEqual('%c' % 0x21483, '\U00021483')
|
||||
self.assertRaises(OverflowError, "%c".__mod__, (0x110000,))
|
||||
self.assertEqual('%c' % '\U00021483', '\U00021483')
|
||||
self.assertRaises(TypeError, "%c".__mod__, "aa")
|
||||
|
||||
# formatting jobs delegated from the string implementation:
|
||||
self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue