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

Function test_rolling_methods

dask/dataframe/tests/test_rolling.py:275–305  ·  view source on GitHub ↗
(method, args, window, center, check_less_precise)

Source from the content-addressed store, hash-verified

273@pytest.mark.parametrize("window", [1, 2, 4, 5])
274@pytest.mark.parametrize("center", [True, False])
275def test_rolling_methods(method, args, window, center, check_less_precise):
276 if check_less_precise:
277 check_less_precise = {"atol": 1e-3, "rtol": 1e-3}
278 else:
279 check_less_precise = {}
280 if method == "count":
281 min_periods = 0
282 else:
283 min_periods = None
284 # DataFrame
285 prolling = df.rolling(window, center=center, min_periods=min_periods)
286 drolling = ddf.rolling(window, center=center, min_periods=min_periods)
287 if method == "apply":
288 kwargs = {"raw": False}
289 else:
290 kwargs = {}
291
292 assert_eq(
293 getattr(prolling, method)(*args, **kwargs),
294 getattr(drolling, method)(*args, **kwargs),
295 **check_less_precise,
296 )
297
298 # Series
299 prolling = df.a.rolling(window, center=center, min_periods=min_periods)
300 drolling = ddf.a.rolling(window, center=center, min_periods=min_periods)
301 assert_eq(
302 getattr(prolling, method)(*args, **kwargs),
303 getattr(drolling, method)(*args, **kwargs),
304 **check_less_precise,
305 )
306
307
308@pytest.mark.parametrize("window", [1, 2, 4, 5])

Callers

nothing calls this directly

Calls 2

assert_eqFunction · 0.90
rollingMethod · 0.45

Tested by

no test coverage detected