code: def test_rolling_with_offset(agg):
      psr = pd.Series(
          [1, 2, 4, 4, np.nan, 9],
          index=[
              pd.Timestamp("20190101 09:00:00"),
              pd.Timestamp("20190101 09:00:01"),
              pd.Timestamp("20190101 09:00:02"),
              pd.Timestamp("20190101 09:00:04"),
              pd.Timestamp("20190101 09:00:07"),
              pd.Timestamp("20190101 09:00:08"),
          ],
      )
      gsr = cudf.from_pandas(psr)
      assert_eq(
          getattr(psr.rolling("2s"), agg)().fillna(-1),
          getattr(gsr.rolling("2s"), agg)().fillna(-1),
          check_dtype=False,
      )
  
imports: import math
  from contextlib import contextmanager
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_150
  from cudf.testing._utils import _create_pandas_series_float64_default, assert_eq
  from cudf.testing.dataset_generator import rand_dataframe
label_desc: Use image node_id 4 for calling a global function with example usage: test_rolling_with_offset(agg) without return types