summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2019-07-24 17:10:02 -0500
committerGitHub <noreply@github.com>2019-07-24 17:10:02 -0500
commit8d14aadace52caa3623263aeb44279339b4ad4c9 (patch)
tree94f822b13852a52f936f926e11e79a9e35065156 /numpy
parent96951ed62ce5ef79dba3fbb41042155590bb81b7 (diff)
parent2df62145f147d93378c50a7b2593c00e3d1129e0 (diff)
downloadnumpy-8d14aadace52caa3623263aeb44279339b4ad4c9.tar.gz
Merge pull request #14091 from IntelPython/update-test-ufunc-noncontiguous
MAINT: adjustments to test_ufunc_noncontigous
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_ufunc.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index 69fbc35e3..707c690dd 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -1933,4 +1933,17 @@ def test_ufunc_noncontiguous(ufunc):
warnings.filterwarnings("always")
res_c = ufunc(*args_c)
res_n = ufunc(*args_n)
- assert_equal(res_c, res_n)
+ if len(out) == 1:
+ res_c = (res_c,)
+ res_n = (res_n,)
+ for c_ar, n_ar in zip(res_c, res_n):
+ dt = c_ar.dtype
+ if np.issubdtype(dt, np.floating):
+ # for floating point results allow a small fuss in comparisons
+ # since different algorithms (libm vs. intrinsics) can be used
+ # for different input strides
+ res_eps = np.finfo(dt).eps
+ tol = 2*res_eps
+ assert_allclose(res_c, res_n, atol=tol, rtol=tol)
+ else:
+ assert_equal(c_ar, n_ar)