code: def test_expanding_greedy_splitter_consecutive():
      """Test that ExpandingGreedySplitter results in consecutive test periods."""
      y_panel = _make_hierarchical(
          hierarchy_levels=(2, 4),
          max_timepoints=20,
          min_timepoints=10,
          same_cutoff=False,
      )
  
      cv = ExpandingGreedySplitter(test_size=2, folds=3)
  
      test_dfs = [tst for _, tst in cv.split_series(y_panel)]
  
      combined_test_df = pd.concat(test_dfs).sort_index()
  
      # We check the .diff(). Equal diffs = uniformly spaced timestamps
      has_consecutive_index = (
          combined_test_df.reset_index(-1)
          .groupby(combined_test_df.index.names[:-1])["time"]
          .agg(lambda s: len(s.diff().value_counts()) == 1)
      )
  
      assert has_consecutive_index.all()
  
file_path: sktime/sktime/split/tests/test_expandinggreedy.py
imports: import numpy
  import pandas
  from sktime.split import ExpandingGreedySplitter
  from sktime.utils._testing.hierarchical import _make_hierarchical
  from sktime.utils._testing.series import _make_series
label_desc: Use image node_id 4 for calling a global function with example usage: test_expanding_greedy_splitter_consecutive() without return types