From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 23 Jan 2018 15:47:15 +0000 (-0800) Subject: bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (GH-5269) (#5285) X-Git-Tag: v3.6.5rc1~146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6abbf14a876ee1e04d1493bb27025f2f0aa56430;p=python 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 370d04d1dcca50a52d59f40aff4d11434f71df6b) --- diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py index 6a3e993265..0c066e633f 100644 --- a/Lib/test/test_codeccallbacks.py +++ b/Lib/test/test_codeccallbacks.py @@ -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 = [