Skip to content

Commit 92dbaa0

Browse files
committed
ENH: add testing of reciprocal
1 parent 7946772 commit 92dbaa0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

array_api_tests/test_operators_and_elementwise_functions.py

+16
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,22 @@ def test_real(x):
15701570
unary_assert_against_refimpl("real", x, out, operator.attrgetter("real"))
15711571

15721572

1573+
@pytest.mark.min_version("2024.12")
1574+
@given(hh.arrays(dtype=hh.floating_dtypes, shape=hh.shapes(), elements=finite_kw))
1575+
def test_reciprocal(x):
1576+
out = xp.reciprocal(x)
1577+
ph.assert_dtype("reciprocal", in_dtype=x.dtype, out_dtype=out.dtype)
1578+
ph.assert_shape("reciprocal", out_shape=out.shape, expected=x.shape)
1579+
refimpl = lambda x: 1.0 / x
1580+
unary_assert_against_refimpl(
1581+
"reciprocal",
1582+
x,
1583+
out,
1584+
refimpl,
1585+
strict_check=True,
1586+
)
1587+
1588+
15731589
@pytest.mark.skip(reason="flaky")
15741590
@pytest.mark.parametrize("ctx", make_binary_params("remainder", dh.real_dtypes))
15751591
@given(data=st.data())

0 commit comments

Comments
 (0)