diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2013-08-06 13:56:26 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-08-06 13:56:26 (GMT) |
| commit | e822b034e766e03cd8fbe7ab52fbc2d46fff6d33 (patch) | |
| tree | a2e79671034ae47c4a0d6d0d030aecda007c8123 /Lib/test/test_unicode.py | |
| parent | 5ad3514822a80c094f1cfe47ae59450001043482 (diff) | |
| download | cpython-e822b034e766e03cd8fbe7ab52fbc2d46fff6d33.zip cpython-e822b034e766e03cd8fbe7ab52fbc2d46fff6d33.tar.gz cpython-e822b034e766e03cd8fbe7ab52fbc2d46fff6d33.tar.bz2 | |
Issue #15866: The xmlcharrefreplace error handler no more produces two XML
entities for a non-BMP character on narrow build.
Diffstat (limited to 'Lib/test/test_unicode.py')
| -rw-r--r-- | Lib/test/test_unicode.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index e44fe03..666cab8 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1658,6 +1658,18 @@ class UnicodeTest( self.assertEqual(unicode_encodedecimal(u"123\u20ac\u0660", "replace"), b'123?0') + def test_encode_decimal_with_surrogates(self): + from _testcapi import unicode_encodedecimal + tests = [(u'\U0001f49d', '💝'), + (u'\ud83d', '�'), + (u'\udc9d', '�'), + (u'\ud83d\udc9d', '💝' if len(u'\U0001f49d') > 1 else + '��'), + ] + for s, exp in tests: + self.assertEqual( + unicode_encodedecimal(u"123" + s, "xmlcharrefreplace"), + '123' + exp) def test_main(): test_support.run_unittest(__name__) |
