From 91a86f6715604183741f84d429a3a5c2fc7d7e9e Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 19 Feb 2016 15:02:35 -0800 Subject: Clarify error on repr failure in assert_equal. assert_equal(np.array([0, 1]), np.matrix([0, 1])) used to print x: array([0, 1]) y: [repr failed] now prints x: array([0, 1]) y: [repr failed for : The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()] --- numpy/testing/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/testing/utils.py') diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index f2588788d..133330a12 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -252,8 +252,8 @@ def build_err_msg(arrays, err_msg, header='Items are not equal:', try: r = r_func(a) - except: - r = '[repr failed]' + except Exception as exc: + r = '[repr failed for <{}>: {}]'.format(type(a).__name__, exc) if r.count('\n') > 3: r = '\n'.join(r.splitlines()[:3]) r += '...' -- cgit v1.2.1