code: def test_rolling_aggs(
      window_size: str,
      closed: ClosedInterval,
      data: st.DataObject,
      time_unit: TimeUnit,
      aggregation: str,
  ) -> None:
      assume(window_size != "")
  
      # Testing logic can be faulty when window is more precise than time unit
      # https://github.com/pola-rs/polars/issues/11754
      assume(not (time_unit == "ms" and "us" in window_size))
  
      dataframe = data.draw(
          dataframes(
              [
                  column(
                      "ts",
                      strategy=st.datetimes(
                          min_value=dt.datetime(2000, 1, 1),
                          max_value=dt.datetime(2001, 1, 1),
                      ),
                      dtype=pl.Datetime(time_unit),
                  ),
                  column(
                      "value",
                      strategy=st.integers(
                          min_value=-100, max_value=100
                      ),
                      dtype=pl.Int64,
                  ),
              ],
          )
      )
      df = dataframe.sort("ts")
      func = f"rolling_{aggregation}"
      result = df.with_columns(
          getattr(pl.col("value"), func)(
              window_size=window_size, by="ts", closed=closed
          )
      )
  
      expected_dict: dict[str, list[object]] = {"ts": [], "value": []}
      for ts, _ in df.iter_rows():
          window = df.filter(
              pl.col("ts").is_between(
                  pl.lit(ts, dtype=pl.Datetime(time_unit)).dt.offset_by(
                      f"-{window_size}"
                  ),
                  pl.lit(ts, dtype=pl.Datetime(time_unit)),
                  closed=closed,
              )
          )
          expected_dict["ts"].append(ts)
          if window.is_empty():
              expected_dict["value"].append(None)
          else:
              value = getattr(window["value"], aggregation)()
              expected_dict["value"].append(value)
      expected = pl.DataFrame(expected_dict).select(
          pl.col("ts").cast(pl.Datetime(time_unit)),
          pl.col("value").cast(result["value"].dtype),
      )
      assert_frame_equal(result, expected)
  
file_path: polars/py-polars/tests/parametric/test_groupby_rolling.py
imports: from __future__ import annotations
  import datetime
  from datetime import timedelta
  from typing import TYPE_CHECKING
  import hypothesis.strategies
  from hypothesis import assume, given
  import polars
  from polars.testing import assert_frame_equal
  from polars.testing.parametric.primitives import column, dataframes
  from polars.testing.parametric.strategies import strategy_closed, strategy_time_unit
  from polars.utils.convert import _timedelta_to_pl_duration
label_desc: Use image node_id 2 for calling a global function with example usage: test_rolling_aggs(window_size, closed, data, time_unit, aggregation) without return types