code: def test_sample_splits():
      """Tests _sample_splits"""
      # final split
      max_splits = 1
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10, max_splits=max_splits
      )
      assert tscv._sample_splits(num_splits=10) == [9]
  
      # last two splits
      max_splits = 2
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10, max_splits=max_splits
      )
      assert tscv._sample_splits(num_splits=10) == [9, 8]
  
      # last two splits, plus randomly selected splits
      max_splits = 8
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10, max_splits=max_splits
      )
      assert tscv._sample_splits(num_splits=10) == [
          9,
          8,
          0,
          7,
          3,
          4,
          6,
          2,
      ]
  
      # all splits
      max_splits = None
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10, max_splits=max_splits
      )
      assert tscv._sample_splits(num_splits=10) == list(range(10))
  
      max_splits = 10
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10, max_splits=max_splits
      )
      assert tscv._sample_splits(num_splits=10) == list(range(10))
  
      max_splits = 15
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10, max_splits=max_splits
      )
      assert tscv._sample_splits(num_splits=10) == list(range(10))
  
      # rolling window evaluation
      # splits from end upto max_splits are kept
      max_splits = 5
      tscv = RollingTimeSeriesSplit(
          forecast_horizon=10,
          use_most_recent_splits=True,
          max_splits=max_splits,
      )
      assert tscv._sample_splits(num_splits=10) == [5, 6, 7, 8, 9]
  
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 9 for calling a global function with example usage: test_sample_splits() without return types