code: def test_expanding_greedy_splitter_hierarchy():
      """Test that ExpandingGreedySplitter handles uneven hierarchical data."""
      y_panel = _make_hierarchical(
          hierarchy_levels=(2, 4),
          max_timepoints=20,
          min_timepoints=10,
          same_cutoff=False,
      )
  
      cv = ExpandingGreedySplitter(test_size=2, folds=3)
  
      # Since same_cutoff=False above, we will have a potentially different end date for
      # each instance in the hierarchy. Below we test that the final fold ends at the
      # correct end date for each instance
      last_test_fold = list(cv.split_series(y_panel))[-1][1]
  
      last_test_dates_actual = (
          last_test_fold.reset_index(-1)
          .groupby(last_test_fold.index.names[:-1])
          .tail(1)["time"]
      )
      last_test_dates_expected = (
          y_panel.reset_index(-1)
          .groupby(y_panel.index.names[:-1])
          .tail(1)["time"]
      )
  
      assert last_test_dates_actual.eq(last_test_dates_expected).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 3 for calling a global function with example usage: test_expanding_greedy_splitter_hierarchy() without return types