code: def test_split_series_hier():
      """Tests that split works with hierarchical data."""
      hierarchy_levels = (2, 4)
      n_instances = np.prod(hierarchy_levels)
      n = 12
      y = _make_hierarchical(
          hierarchy_levels=hierarchy_levels,
          max_timepoints=n,
          min_timepoints=n,
      )
      cv = SlidingWindowSplitter()
  
      for train, test in cv.split(y):
          assert isinstance(train, np.ndarray)
          assert train.ndim == 1
          assert train.dtype == np.int64
          assert len(train) == 10 * n_instances
          assert isinstance(test, np.ndarray)
          assert test.ndim == 1
          assert pd.api.types.is_integer_dtype(test.dtype)
          assert len(test) == 1 * n_instances
  
      for train, test in cv.split_loc(y):
          assert isinstance(train, pd.MultiIndex)
          assert len(train) == 10 * n_instances
          assert train.isin(y.index).all()
          assert isinstance(test, pd.MultiIndex)
          assert len(test) == 1 * n_instances
          assert test.isin(y.index).all()
  
      def inst_index(y):
          return set(y.index.droplevel(-1).unique())
  
      for train, test in cv.split_series(y):
          assert isinstance(train, pd.DataFrame)
          assert len(train) == 10 * n_instances
          assert isinstance(test, pd.DataFrame)
          assert len(test) == 1 * n_instances
          assert inst_index(train) == inst_index(y)
          assert inst_index(test) == inst_index(y)
  
file_path: sktime/sktime/split/base/tests/test_base.py
imports: import numpy
  import pandas
  import pytest
  from sktime.forecasting.tests._config import TEST_FHS, TEST_FHS_TIMEDELTA, TEST_STEP_LENGTHS, TEST_WINDOW_LENGTHS
  from sktime.split.base._common import _inputs_are_supported
  from sktime.split.expandingwindow import ExpandingWindowSplitter
  from sktime.split.singlewindow import SingleWindowSplitter
  from sktime.split.slidingwindow import SlidingWindowSplitter
  from sktime.utils._testing.hierarchical import _make_hierarchical
  from sktime.utils._testing.panel import _make_panel
  from sktime.utils._testing.series import _make_series
label_desc: Use image node_id 3 for calling a global function with example usage: test_split_series_hier() and returns: set