| 651 | @pytest.mark.parametrize("axis", [None, 0, 1, -1]) |
| 652 | @pytest.mark.parametrize("method", ["sequential", "blelloch"]) |
| 653 | def test_array_cumreduction_axis(func, use_nan, axis, method): |
| 654 | np_func = getattr(np, func) |
| 655 | da_func = getattr(da, func) |
| 656 | |
| 657 | s = (10, 11, 12) |
| 658 | a = np.arange(np.prod(s), dtype=float).reshape(s) |
| 659 | if use_nan: |
| 660 | a[1] = np.nan |
| 661 | d = da.from_array(a, chunks=(4, 5, 6)) |
| 662 | if func in ["cumprod", "nancumprod"] and method == "blelloch" and axis is None: |
| 663 | with pytest.warns(RuntimeWarning): |
| 664 | da_func(d, axis=axis, method=method).compute() |
| 665 | return |
| 666 | |
| 667 | a_r = np_func(a, axis=axis) |
| 668 | d_r = da_func(d, axis=axis, method=method) |
| 669 | |
| 670 | assert_eq(a_r, d_r) |
| 671 | |
| 672 | |
| 673 | @pytest.mark.parametrize("func", ["cumsum", "cumprod", "nancumsum", "nancumprod"]) |