Skip to content

Commit

Permalink
ENH: add testing of reciprocal
Browse files Browse the repository at this point in the history
  • Loading branch information
ev-br committed Nov 29, 2024
1 parent 0469c0c commit d649c0c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions array_api_tests/test_operators_and_elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,22 @@ def test_pow(ctx, data):
# Values testing pow is too finicky


@pytest.mark.min_version("2024.12")
@given(hh.arrays(dtype=hh.floating_dtypes, shape=hh.shapes(), elements=finite_kw))
def test_reciprocal(x):
out = xp.reciprocal(x)
ph.assert_dtype("reciprocal", in_dtype=x.dtype, out_dtype=out.dtype)
ph.assert_shape("reciprocal", out_shape=out.shape, expected=x.shape)
refimpl = lambda x: 1.0 / x
unary_assert_against_refimpl(
"reciprocal",
x,
out,
refimpl,
strict_check=True,
)


if api_version >= "2022.12":

@given(hh.arrays(dtype=hh.complex_dtypes, shape=hh.shapes()))
Expand Down

0 comments on commit d649c0c

Please sign in to comment.