summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index d2799c3..b17cded 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -571,6 +571,16 @@ class UTF8Test(ReadTest):
def test_lone_surrogates(self):
self.assertRaises(UnicodeEncodeError, "\ud800".encode, "utf-8")
self.assertRaises(UnicodeDecodeError, b"\xed\xa0\x80".decode, "utf-8")
+ self.assertEqual("[\uDC80]".encode("utf-8", "backslashreplace"),
+ b'[\\udc80]')
+ self.assertEqual("[\uDC80]".encode("utf-8", "xmlcharrefreplace"),
+ b'[�]')
+ self.assertEqual("[\uDC80]".encode("utf-8", "surrogateescape"),
+ b'[\x80]')
+ self.assertEqual("[\uDC80]".encode("utf-8", "ignore"),
+ b'[]')
+ self.assertEqual("[\uDC80]".encode("utf-8", "replace"),
+ b'[?]')
def test_surrogatepass_handler(self):
self.assertEquals("abc\ud800def".encode("utf-8", "surrogatepass"),