MCPcopy Create free account
hub / github.com/dask/dask / test_array_cumreduction_axis

Function test_array_cumreduction_axis

dask/array/tests/test_reductions.py:653–670  ·  view source on GitHub ↗
(func, use_nan, axis, method)

Source from the content-addressed store, hash-verified

651@pytest.mark.parametrize("axis", [None, 0, 1, -1])
652@pytest.mark.parametrize("method", ["sequential", "blelloch"])
653def 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"])

Callers

nothing calls this directly

Calls 5

assert_eqFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45
prodMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected