code: def test_datelike_on_monotonic_within_each_group(self):
      # GH 13966 (similar to #15130, closed by #15175)
  
      # superseded by 43909
      # GH 46061: OK if the on is monotonic relative to each each group
  
      dates = date_range(
          start="2016-01-01 09:30:00", periods=20, freq="s"
      )
      df = DataFrame(
          {
              "A": [1] * 20 + [2] * 12 + [3] * 8,
              "B": np.concatenate((dates, dates)),
              "C": np.arange(40),
          }
      )
  
      msg = "DataFrameGroupBy.apply operated on the grouping columns"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          expected = (
              df.set_index("B")
              .groupby("A")
              .apply(lambda x: x.rolling("4s")["C"].mean())
          )
      result = df.groupby("A").rolling("4s", on="B").C.mean()
      tm.assert_series_equal(result, expected)
  
imports: import numpy
  import pytest
  from pandas import DataFrame, DatetimeIndex, Index, MultiIndex, Series, Timestamp, date_range, to_datetime
  import pandas._testing
  from pandas.api.indexers import BaseIndexer
  from pandas.core.groupby.groupby import get_groupby
label_desc: Use image node_id 41 for calling the TestRolling obj's underlying member method code with example usage: obj.test_datelike_on_monotonic_within_each_group() without return types