From 535fd1f3117e0f7d72abc80bfe1faef7033146b5 Mon Sep 17 00:00:00 2001 From: abrammer Date: Sun, 29 Jul 2018 23:12:04 -0400 Subject: [PATCH] may as well include inf test while we're at it --- testing/python/approx.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testing/python/approx.py b/testing/python/approx.py index 130547704..0509fa672 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -390,6 +390,20 @@ class TestApprox(object): assert op(np.array(a), approx(x, nan_ok=True)) assert op(a, approx(np.array(x), nan_ok=True)) + def test_numpy_expecting_inf(self): + np = pytest.importorskip("numpy") + examples = [ + (eq, inf, inf), + (eq, -inf, -inf), + (ne, inf, -inf), + (ne, 0.0, inf), + (ne, nan, inf), + ] + for op, a, x in examples: + assert op(np.array(a), approx(x)) + assert op(a, approx(np.array(x))) + assert op(np.array(a), approx(np.array(x))) + def test_numpy_array_wrong_shape(self): np = pytest.importorskip("numpy")