code: def test_rolling_time_series_split2():
      """Tests rolling_time_series_split with custom values"""
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=2,
          min_train_periods=4,
          expanding_window=True,
          use_most_recent_splits=False,
          periods_between_splits=4,
          periods_between_train_test=2,
          max_splits=None,
      )
  
      assert tscv.forecast_horizon == 2
      assert tscv.min_train_periods == 4
      assert tscv.expanding_window
      assert not tscv.use_most_recent_splits
      assert tscv.periods_between_splits == 4
      assert tscv.periods_between_train_test == 2
  
      X = np.random.rand(20, 4)
      expected = [  # no offset
          (np.array([0, 1, 2, 3]), np.array([6, 7])),
          (np.array([0, 1, 2, 3, 4, 5, 6, 7]), np.array([10, 11])),
          (
              np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]),
              np.array([14, 15]),
          ),
          (
              np.array(
                  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
              ),
              np.array([18, 19]),
          ),
      ]
      assert tscv.get_n_splits(X=X) == 4
      assert_splits_equal(tscv.split(X=X), expected)
  
      X = np.random.rand(25, 4)
      expected = [
          # offset with expanding window, first training is set larger than min_train_periods to use all data
          (np.arange(5), np.array([7, 8])),
          (np.arange(9), np.array([11, 12])),
          (np.arange(13), np.array([15, 16])),
          (np.arange(17), np.array([19, 20])),
          (np.arange(21), np.array([23, 24])),
      ]
      assert tscv.get_n_splits(X=X) == 5
      assert_splits_equal(tscv.split(X=X), expected)
  
file_path: greykite/greykite/tests/sklearn/test_cross_validation.py
imports: import numpy
  import pytest
  from greykite.sklearn.cross_validation import RollingTimeSeriesSplit
label_desc: Use image node_id 3 for calling a global function with example usage: test_rolling_time_series_split2() without return types