mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (GH-5269) (#5285)
It should test both test.replacing and test.mutating instead of test test.replacing twice.
(cherry picked from commit 370d04d1dc
)
This commit is contained in:
parent
4002d5dbf4
commit
6abbf14a87
1 changed files with 2 additions and 3 deletions
|
@ -1032,7 +1032,7 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
|
||||
def mutating(exc):
|
||||
if isinstance(exc, UnicodeDecodeError):
|
||||
exc.object[:] = b""
|
||||
exc.object = b""
|
||||
return ("\u4242", 0)
|
||||
else:
|
||||
raise TypeError("don't know how to handle %r" % exc)
|
||||
|
@ -1042,8 +1042,7 @@ class CodecCallbackTest(unittest.TestCase):
|
|||
with test.support.check_warnings():
|
||||
# unicode-internal has been deprecated
|
||||
for (encoding, data) in baddata:
|
||||
with self.assertRaises(TypeError):
|
||||
data.decode(encoding, "test.replacing")
|
||||
self.assertEqual(data.decode(encoding, "test.mutating"), "\u4242")
|
||||
|
||||
def test_fake_error_class(self):
|
||||
handlers = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue