Skip to content

Commit 535fd1f

Browse files
author
abrammer
committed
may as well include inf test while we're at it
1 parent 762eaf4 commit 535fd1f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

testing/python/approx.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,20 @@ def test_numpy_expecting_nan(self):
390390
assert op(np.array(a), approx(x, nan_ok=True))
391391
assert op(a, approx(np.array(x), nan_ok=True))
392392

393+
def test_numpy_expecting_inf(self):
394+
np = pytest.importorskip("numpy")
395+
examples = [
396+
(eq, inf, inf),
397+
(eq, -inf, -inf),
398+
(ne, inf, -inf),
399+
(ne, 0.0, inf),
400+
(ne, nan, inf),
401+
]
402+
for op, a, x in examples:
403+
assert op(np.array(a), approx(x))
404+
assert op(a, approx(np.array(x)))
405+
assert op(np.array(a), approx(np.array(x)))
406+
393407
def test_numpy_array_wrong_shape(self):
394408
np = pytest.importorskip("numpy")
395409

0 commit comments

Comments
 (0)