Skip to content

Commit

Permalink
TST: Explicitly ignore promotion issues for array**2 in hypothesis test
Browse files Browse the repository at this point in the history
  • Loading branch information
seberg authored and charris committed Feb 2, 2023
1 parent 42bfe1a commit c115e12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion numpy/core/tests/test_scalarmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ def check_ufunc_scalar_equivalence(op, arr1, arr2):
comp_ops = {operator.ge, operator.gt, operator.le, operator.lt}
if op in comp_ops and (np.isnan(scalar1) or np.isnan(scalar2)):
pytest.xfail("complex comp ufuncs use sort-order, scalars do not.")
if op == operator.pow and arr2.item() in [-1, 0, 0.5, 1, 2]:
# array**scalar special case can have different result dtype
# (Other powers may have issues also, but are not hit here.)
# TODO: It would be nice to resolve this issue.
pytest.skip("array**2 can have incorrect/weird result dtype")

# ignore fpe's since they may just mismatch for integers anyway.
with warnings.catch_warnings(), np.errstate(all="ignore"):
Expand Down Expand Up @@ -121,7 +126,7 @@ def test_array_scalar_ufunc_dtypes(op, dt1, dt2):
# Same as above, but don't worry about sampling weird values so that we
# do not have to sample as much
arr1 = np.array(2, dtype=dt1)
arr2 = np.array(1, dtype=dt2) # power of 2 does weird things for arrays
arr2 = np.array(3, dtype=dt2) # some power do weird things.

check_ufunc_scalar_equivalence(op, arr1, arr2)

Expand Down

0 comments on commit c115e12

Please sign in to comment.