[Python-checkins] bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (#5269)
Xiang Zhang
webhook-mailer at python.org
Tue Jan 23 09:50:53 EST 2018
https://github.com/python/cpython/commit/370d04d1dcca50a52d59f40aff4d11434f71df6b
commit: 370d04d1dcca50a52d59f40aff4d11434f71df6b
branch: master
author: Xiang Zhang <angwerzx at 126.com>
committer: GitHub <noreply at github.com>
date: 2018-01-23T22:50:50+08:00
summary:
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.
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