diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-04 21:26:43 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-04 21:26:43 (GMT) |
commit | a4db68622c585e1bb526ef89f5d5ccf602906110 (patch) | |
tree | 3c2f15bbc29fec0bd7d127d7e6e540fc626d6665 /Lib/test/test_unicode.py | |
parent | 142957ce952c067414df3503431ab36a91c9c40c (diff) | |
download | cpython-a4db68622c585e1bb526ef89f5d5ccf602906110.zip cpython-a4db68622c585e1bb526ef89f5d5ccf602906110.tar.gz cpython-a4db68622c585e1bb526ef89f5d5ccf602906110.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 4c81205..fb904bf 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -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...') |