bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (… · python/cpython@370d04d (original) (raw)

Original file line number Diff line number Diff line change
@@ -1032,7 +1032,7 @@ def replacing(exc):
1032 1032
1033 1033 def mutating(exc):
1034 1034 if isinstance(exc, UnicodeDecodeError):
1035 -exc.object[:] = b""
1035 +exc.object = b""
1036 1036 return ("\u4242", 0)
1037 1037 else:
1038 1038 raise TypeError("don't know how to handle %r" % exc)
@@ -1042,8 +1042,7 @@ def mutating(exc):
1042 1042 with test.support.check_warnings():
1043 1043 # unicode-internal has been deprecated
1044 1044 for (encoding, data) in baddata:
1045 -with self.assertRaises(TypeError):
1046 -data.decode(encoding, "test.replacing")
1045 +self.assertEqual(data.decode(encoding, "test.mutating"), "\u4242")
1047 1046
1048 1047 def test_fake_error_class(self):
1049 1048 handlers = [