Unverified Kaydet (Commit) 370d04d1 authored tarafından Xiang Zhang's avatar Xiang Zhang Kaydeden (comit) GitHub

bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (#5269)

* bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating

It should test both test.replacing and test.mutating instead of test test.replacing twice.
üst dc6b9462
...@@ -1032,7 +1032,7 @@ class CodecCallbackTest(unittest.TestCase): ...@@ -1032,7 +1032,7 @@ class CodecCallbackTest(unittest.TestCase):
def mutating(exc): def mutating(exc):
if isinstance(exc, UnicodeDecodeError): if isinstance(exc, UnicodeDecodeError):
exc.object[:] = b"" exc.object = b""
return ("\u4242", 0) return ("\u4242", 0)
else: else:
raise TypeError("don't know how to handle %r" % exc) raise TypeError("don't know how to handle %r" % exc)
...@@ -1042,8 +1042,7 @@ class CodecCallbackTest(unittest.TestCase): ...@@ -1042,8 +1042,7 @@ class CodecCallbackTest(unittest.TestCase):
with test.support.check_warnings(): with test.support.check_warnings():
# unicode-internal has been deprecated # unicode-internal has been deprecated
for (encoding, data) in baddata: for (encoding, data) in baddata:
with self.assertRaises(TypeError): self.assertEqual(data.decode(encoding, "test.mutating"), "\u4242")
data.decode(encoding, "test.replacing")
def test_fake_error_class(self): def test_fake_error_class(self):
handlers = [ handlers = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment