mirror of
https://github.com/python/cpython.git
synced 2025-10-13 10:23:28 +00:00
Rename the surrogates error handler to surrogatepass.
This commit is contained in:
parent
cf7925dfc6
commit
e0a2b72e61
6 changed files with 25 additions and 25 deletions
|
@ -545,12 +545,12 @@ class UTF8Test(ReadTest):
|
|||
self.assertRaises(UnicodeEncodeError, "\ud800".encode, "utf-8")
|
||||
self.assertRaises(UnicodeDecodeError, b"\xed\xa0\x80".decode, "utf-8")
|
||||
|
||||
def test_surrogates_handler(self):
|
||||
self.assertEquals("abc\ud800def".encode("utf-8", "surrogates"),
|
||||
def test_surrogatepass_handler(self):
|
||||
self.assertEquals("abc\ud800def".encode("utf-8", "surrogatepass"),
|
||||
b"abc\xed\xa0\x80def")
|
||||
self.assertEquals(b"abc\xed\xa0\x80def".decode("utf-8", "surrogates"),
|
||||
self.assertEquals(b"abc\xed\xa0\x80def".decode("utf-8", "surrogatepass"),
|
||||
"abc\ud800def")
|
||||
self.assertTrue(codecs.lookup_error("surrogates"))
|
||||
self.assertTrue(codecs.lookup_error("surrogatepass"))
|
||||
|
||||
class UTF7Test(ReadTest):
|
||||
encoding = "utf-7"
|
||||
|
@ -1040,12 +1040,12 @@ class NameprepTest(unittest.TestCase):
|
|||
# Skipped
|
||||
continue
|
||||
# The Unicode strings are given in UTF-8
|
||||
orig = str(orig, "utf-8", "surrogates")
|
||||
orig = str(orig, "utf-8", "surrogatepass")
|
||||
if prepped is None:
|
||||
# Input contains prohibited characters
|
||||
self.assertRaises(UnicodeError, nameprep, orig)
|
||||
else:
|
||||
prepped = str(prepped, "utf-8", "surrogates")
|
||||
prepped = str(prepped, "utf-8", "surrogatepass")
|
||||
try:
|
||||
self.assertEquals(nameprep(orig), prepped)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue