| 348 | ) |
| 349 | @pytest.mark.parametrize("window", ["1s", "2s", "3s", pd.offsets.Second(5)]) |
| 350 | def test_time_rolling_methods(method, args, window, check_less_precise): |
| 351 | if check_less_precise: |
| 352 | check_less_precise = {"atol": 1e-3, "rtol": 1e-3} |
| 353 | else: |
| 354 | check_less_precise = {} |
| 355 | |
| 356 | # DataFrame |
| 357 | if method == "apply": |
| 358 | kwargs = {"raw": False} |
| 359 | else: |
| 360 | kwargs = {} |
| 361 | prolling = ts.rolling(window) |
| 362 | drolling = dts.rolling(window) |
| 363 | assert_eq( |
| 364 | getattr(prolling, method)(*args, **kwargs), |
| 365 | getattr(drolling, method)(*args, **kwargs), |
| 366 | **check_less_precise, |
| 367 | ) |
| 368 | |
| 369 | # Series |
| 370 | prolling = ts.a.rolling(window) |
| 371 | drolling = dts.a.rolling(window) |
| 372 | assert_eq( |
| 373 | getattr(prolling, method)(*args, **kwargs), |
| 374 | getattr(drolling, method)(*args, **kwargs), |
| 375 | **check_less_precise, |
| 376 | ) |
| 377 | |
| 378 | |
| 379 | @pytest.mark.parametrize("window", ["1s", "2s", "3s", pd.offsets.Second(5)]) |