Skip to content

Commit 370d04d

Browse files
authored
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.
1 parent dc6b946 commit 370d04d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/test/test_codeccallbacks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ def replacing(exc):
10321032

10331033
def mutating(exc):
10341034
if isinstance(exc, UnicodeDecodeError):
1035-
exc.object[:] = b""
1035+
exc.object = b""
10361036
return ("\u4242", 0)
10371037
else:
10381038
raise TypeError("don't know how to handle %r" % exc)
@@ -1042,8 +1042,7 @@ def mutating(exc):
10421042
with test.support.check_warnings():
10431043
# unicode-internal has been deprecated
10441044
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")
10471046

10481047
def test_fake_error_class(self):
10491048
handlers = [

0 commit comments

Comments
 (0)