summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/_internal.py5
-rw-r--r--numpy/core/tests/test_umath.py10
2 files changed, 8 insertions, 7 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 10fcbfdfe..9c46b3297 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -695,10 +695,11 @@ def array_ufunc_errmsg_formatter(dummy, ufunc, method, *inputs, **kwargs):
for k, v in kwargs.items()])
args = inputs + kwargs.get('out', ())
types_string = ', '.join(repr(type(arg).__name__) for arg in args)
- return ('operand type(s) do not implement __array_ufunc__'
- '({!r}, {!r}, {}): {}'
+ return ('operand type(s) all returned NotImplemented from '
+ '__array_ufunc__({!r}, {!r}, {}): {}'
.format(ufunc, method, args_string, types_string))
+
def _ufunc_doc_signature_formatter(ufunc):
"""
Builds a signature string which resembles PEP 457
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 13f29504a..9e849df92 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -1931,14 +1931,14 @@ class TestSpecialMethods(TestCase):
def __array_ufunc__(self, *args, **kwargs):
return NotImplemented
- msg = ("operand type(s) do not implement __array_ufunc__("
- "<ufunc 'negative'>, '__call__', <*>): 'A'")
+ msg = ("operand type(s) all returned NotImplemented from "
+ "__array_ufunc__(<ufunc 'negative'>, '__call__', <*>): 'A'")
with assert_raises_regex(TypeError, fnmatch.translate(msg)):
np.negative(A())
- msg = ("operand type(s) do not implement __array_ufunc__("
- "<ufunc 'add'>, '__call__', <*>, <object *>, out=(1,)): "
- "'A', 'object', 'int'")
+ msg = ("operand type(s) all returned NotImplemented from "
+ "__array_ufunc__(<ufunc 'add'>, '__call__', <*>, <object *>, "
+ "out=(1,)): 'A', 'object', 'int'")
with assert_raises_regex(TypeError, fnmatch.translate(msg)):
np.add(A(), object(), out=1)