From 48089a72d6f4c3805ce0a53618cc9652287c5018 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Thu, 26 Dec 2019 07:21:59 +0100 Subject: TST: improve assert message of assert_array_max_ulp It was not showing the max difference before, which makes it hard to judge whether something is seriously wrong, or the test precision simply needs to be bumped by a little. --- numpy/testing/_private/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'numpy/testing/_private/utils.py') diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 23267a9e1..870671d05 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -1636,8 +1636,9 @@ def assert_array_max_ulp(a, b, maxulp=1, dtype=None): import numpy as np ret = nulp_diff(a, b, dtype) if not np.all(ret <= maxulp): - raise AssertionError("Arrays are not almost equal up to %g ULP" % - maxulp) + raise AssertionError("Arrays are not almost equal up to %g " + "ULP (max difference is %g ULP)" % + (maxulp, np.max(ret))) return ret -- cgit v1.2.1