MCPcopy
hub / github.com/pydata/xarray / test_cumulative

Function test_cumulative

xarray/tests/test_rolling.py:29–41  ·  view source on GitHub ↗
(d, func, min_periods)

Source from the content-addressed store, hash-verified

27@pytest.mark.parametrize("func", ["mean", "sum"])
28@pytest.mark.parametrize("min_periods", [1, 10])
29def test_cumulative(d, func, min_periods) -> None:
30 # One dim
31 result = getattr(d.cumulative("z", min_periods=min_periods), func)()
32 expected = getattr(d.rolling(z=d["z"].size, min_periods=min_periods), func)()
33 assert_identical(result, expected)
34
35 # Multiple dim
36 result = getattr(d.cumulative(["z", "x"], min_periods=min_periods), func)()
37 expected = getattr(
38 d.rolling(z=d["z"].size, x=d["x"].size, min_periods=min_periods),
39 func,
40 )()
41 assert_identical(result, expected)
42
43
44def test_cumulative_vs_cum(d) -> None:

Callers

nothing calls this directly

Calls 3

assert_identicalFunction · 0.90
cumulativeMethod · 0.45
rollingMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…