code: def test_set_freq_hier():
      """Test that setting frequency on a DatetimeIndex MultiIndex works."""
      # from pandas 2.1.0 on, freq is preserved correctly,
      # so in that case we artificially destroy the freq attribute
      pandas_210 = _check_soft_dependencies(
          "pandas>=2.1.0", severity="none"
      )
  
      y = load_airline()
  
      assert get_time_index(y).freq is not None
  
      # Convert to DatetimeIndex
      y_index = y.index.to_timestamp()
  
      assert get_time_index(y).freq is not None
  
      if pandas_210:
          y_index.freq = None
  
      # Create MultiIndex
      mi = pd.MultiIndex.from_product(
          [[0], y_index], names=["instances", "timepoints"]
      )
      y_group1 = pd.DataFrame(y.values, index=mi, columns=["y"])
  
      mi = pd.MultiIndex.from_product(
          [[1], y_index], names=["instances", "timepoints"]
      )
      y_group2 = pd.DataFrame(y.values, index=mi, columns=["y"])
  
      y_train_grp = pd.concat([y_group1, y_group2])
  
      assert get_time_index(y_train_grp).freq is None
  
      y_train_grp = set_hier_freq(y_train_grp)
  
      assert get_time_index(y_train_grp).freq is not None
  
file_path: sktime/sktime/utils/tests/test_datetime.py
imports: import datetime
  import numpy
  import pandas
  from sktime.datasets import load_airline
  from sktime.datatypes import VectorizedDF
  from sktime.datatypes._utilities import get_time_index
  from sktime.utils._testing.hierarchical import _bottom_hier_datagen
  from sktime.utils.datetime import _coerce_duration_to_int, _get_freq, infer_freq, set_hier_freq
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 5 for calling a global function with example usage: test_set_freq_hier() without return types