Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_unicode.py @ 68087:ef28aad3bbae
Fix PyUnicode_FromFormatV("%c") for non-BMP char
Issue #10830: Fix PyUnicode_FromFormatV("%c") for non-BMP characters on
narrow build.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Mon, 21 Feb 2011 21:13:44 +0000 |
| parents | 3ef865327d7b |
| children | 72f30f8ef331 be6c38d1817b |
line wrap: on
line diff
--- a/Lib/test/test_unicode.py Mon Feb 21 21:05:50 2011 +0000 +++ b/Lib/test/test_unicode.py Mon Feb 21 21:13:44 2011 +0000 @@ -1427,7 +1427,7 @@ # Test PyUnicode_FromFormat() def test_from_format(self): support.import_module('ctypes') - from ctypes import pythonapi, py_object + from ctypes import pythonapi, py_object, c_int if sys.maxunicode == 65535: name = "PyUnicodeUCS2_FromFormat" else: @@ -1452,6 +1452,9 @@ 'string, got a non-ASCII byte: 0xe9$', PyUnicode_FromFormat, b'unicode\xe9=%s', 'ascii') + self.assertEqual(PyUnicode_FromFormat(b'%c', c_int(0xabcd)), '\uabcd') + self.assertEqual(PyUnicode_FromFormat(b'%c', c_int(0x10ffff)), '\U0010ffff') + # other tests text = PyUnicode_FromFormat(b'%%A:%A', 'abc\xe9\uabcd\U0010ffff') self.assertEqual(text, r"%A:'abc\xe9\uabcd\U0010ffff'")
