may as well include inf test while we're at it

This commit is contained in:
abrammer 2018-07-29 23:12:04 -04:00
parent 762eaf443a
commit 535fd1f311
1 changed files with 14 additions and 0 deletions

View File

@ -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")