summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorMark Wiebe <mwwiebe@gmail.com>2011-01-26 10:57:17 -0800
committerMark Wiebe <mwwiebe@gmail.com>2011-01-27 21:39:28 -0800
commitc4a556e1fcdede5fe366e4373a7f2dc802a0e898 (patch)
treed1b8d60ad4f51221b434edb87a9178370c24d07e /numpy/testing/utils.py
parent98721b3f06626314e47afa6d1ad9a1a0d3746412 (diff)
downloadnumpy-c4a556e1fcdede5fe366e4373a7f2dc802a0e898.tar.gz
BUG: core: Fix things so scipy trunk passes all tests (but one)
With this patch, the latest scipy trunk (7087), built against NumPy 1.5.1, passes all tests when run against the numpy trunk. The single failing test, test_imresize, fails because it tests all float types, and the new 'half' type lacks the precision to pass that test.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 6f18b5468..1a03f98ea 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -421,7 +421,7 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
usecomplex = False
msg = build_err_msg([actual, desired], err_msg, verbose=verbose,
- header='Arrays are not almost equal')
+ header=('Arrays are not almost equal to %d decimals' % decimal))
if usecomplex:
if iscomplexobj(actual):
@@ -616,7 +616,8 @@ def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
names=('x', 'y'))
if not cond :
raise AssertionError(msg)
- except ValueError:
+ except ValueError as e:
+ header = 'error during assertion:\n%s\n\n%s' % (e, header)
msg = build_err_msg([x, y], err_msg, verbose=verbose, header=header,
names=('x', 'y'))
raise ValueError(msg)
@@ -771,7 +772,7 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):
z = z.astype(float_) # handle object arrays
return around(z, decimal) <= 10.0**(-decimal)
assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
- header='Arrays are not almost equal')
+ header=('Arrays are not almost equal to %d decimals' % decimal))
def assert_array_less(x, y, err_msg='', verbose=True):
"""