Author: Jean-Paul Calderone <[email protected]>
Branch: py3.5
Changeset: r92030:4499d3bd3e6f
Date: 2017-08-02 07:41 -0400
http://bitbucket.org/pypy/pypy/changeset/4499d3bd3e6f/
Log: Fix test_unflagged_non_text_codec_handling
test_unflagged_non_text_codec_handling
(test.test_codecs.ExceptionChainingTest) expected a different
exception message from misbehaving codecs. Update the message to
reflect this.
diff --git a/pypy/objspace/std/unicodeobject.py
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -576,7 +576,9 @@
w_retval = encode_text(space, w_object, encoding, errors)
if not space.isinstance_w(w_retval, space.w_bytes):
raise oefmt(space.w_TypeError,
- "encoder did not return a bytes object (type '%T')",
+ "'%s' encoder returned '%T' instead of 'bytes'; "
+ "use codecs.encode() to encode to arbitrary types",
+ encoding,
w_retval)
return w_retval
@@ -604,7 +606,9 @@
w_retval = decode_text(space, w_obj, encoding, errors)
if not space.isinstance_w(w_retval, space.w_unicode):
raise oefmt(space.w_TypeError,
- "decoder did not return a bytes object (type '%T')",
+ "'%s' decoder returned '%T' instead of 'str'; "
+ "use codecs.decode() to decode to arbitrary types",
+ encoding,
w_retval)
return w_retval
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit