diff options
| author | Sebastian Berg <sebastianb@nvidia.com> | 2023-01-24 13:24:04 +0100 |
|---|---|---|
| committer | Sebastian Berg <sebastianb@nvidia.com> | 2023-01-24 15:35:04 +0100 |
| commit | 30b62f80b18414d340d421b56f5698f920fa4526 (patch) | |
| tree | 7bfc3f0e0c6ea7ee2a02e3c5fe200f6abe48fb86 | |
| parent | d3501206677a4bccdf4b5ab6c9365a84ef26096e (diff) | |
| download | numpy-30b62f80b18414d340d421b56f5698f920fa4526.tar.gz | |
TST: Explicitly ignore promotion issues for array**2 in hypothesis test
| -rw-r--r-- | numpy/core/tests/test_scalarmath.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index 16194d023..79423cda0 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -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"): @@ -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) |
