code: def test_same_loc_splitter_hierarchical():
      """Test that SameLocSplitter works as intended for hierarchical data."""
      hierarchy_levels1 = (2, 2)
      hierarchy_levels2 = (3, 4)
      n1 = 7
      n2 = 2 * n1
      y_template = _make_hierarchical(
          hierarchy_levels=hierarchy_levels1,
          max_timepoints=n1,
          min_timepoints=n1,
      )
  
      y = _make_hierarchical(
          hierarchy_levels=hierarchy_levels2,
          max_timepoints=n2,
          min_timepoints=n2,
      )
  
      cv_tpl = ExpandingWindowSplitter(
          fh=[1, 2], initial_window=1, step_length=2
      )
  
      splitter = SameLocSplitter(cv_tpl, y_template)
  
      # these should be in general the same
      split_template_loc = list(cv_tpl.split_loc(y_template))
      split_templated_loc = list(splitter.split_loc(y))
  
      for (t1, tt1), (t2, tt2) in zip(
          split_template_loc, split_templated_loc
      ):
          assert np.all(t1 == t2)
          assert np.all(tt1 == tt2)
  
imports: import numpy
  from sktime.split import ExpandingWindowSplitter, SameLocSplitter
  from sktime.utils._testing.hierarchical import _make_hierarchical
label_desc: Use image node_id 2 for calling a global function with example usage: test_same_loc_splitter_hierarchical() without return types