[Python-checkins] bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (GH-5269) (#5285)
Xiang Zhang
webhook-mailer at python.org
Tue Jan 23 10:47:21 EST 2018
https://github.com/python/cpython/commit/6abbf14a876ee1e04d1493bb27025f2f0aa56430
commit: 6abbf14a876ee1e04d1493bb27025f2f0aa56430
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Xiang Zhang <angwerzx at 126.com>
date: 2018-01-23T23:47:15+08:00
summary:
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)
files:
M Lib/test/test_codeccallbacks.py
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
index 6a3e9932656..0c066e633fa 100644
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -1032,7 +1032,7 @@ def replacing(exc):
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 @@ def mutating(exc):
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 = [
More information about the Python-checkins
mailing list