| 2791 | pytest.param(lambda x: np.add.reduceat(x, [0]), id="reduceat"), |
| 2792 | pytest.param(lambda x: np.log.at(x, [2]), id="at")]) |
| 2793 | def test_ufunc_methods_floaterrors(method): |
| 2794 | # adding inf and -inf (or log(-inf) creates an invalid float and warns |
| 2795 | arr = np.array([np.inf, 0, -np.inf]) |
| 2796 | with np.errstate(all="warn"): |
| 2797 | with pytest.warns(RuntimeWarning, match="invalid value"): |
| 2798 | method(arr) |
| 2799 | |
| 2800 | arr = np.array([np.inf, 0, -np.inf]) |
| 2801 | with np.errstate(all="raise"): |
| 2802 | with pytest.raises(FloatingPointError): |
| 2803 | method(arr) |
| 2804 | |
| 2805 | |
| 2806 | def _check_neg_zero(value): |