code: def test_fh(index_type, fh_type, is_relative, steps):
      """Testing ForecastingHorizon conversions."""
      int_types = ["int64", "int32"]
      steps_is_int = (
          isinstance(steps, (int, np.integer))
          or np.array(steps).dtype in int_types
      )
      steps_is_timedelta = isinstance(steps, pd.Timedelta) or (
          isinstance(steps, list)
          and isinstance(pd.Index(steps), pd.TimedeltaIndex)
      )
      steps_and_fh_incompatible = (
          fh_type == "timedelta" and steps_is_int
      ) or (fh_type != "timedelta" and steps_is_timedelta)
      if steps_and_fh_incompatible:
          pytest.skip("steps and fh_type are incompatible")
      # generate data
      y = make_forecasting_problem(index_type=index_type)
      if index_type == "int":
          assert is_integer_index(y.index)
      else:
          assert isinstance(y.index, INDEX_TYPE_LOOKUP.get(index_type))
  
      # split data
      y_train, y_test = temporal_train_test_split(y, test_size=10)
  
      # choose cutoff point
      cutoff_idx = get_cutoff(y_train, return_index=True)
      cutoff = cutoff_idx[0]
  
      # generate fh
      fh = _make_fh(cutoff_idx, steps, fh_type, is_relative)
      # update frequency of the forecasting horizon
      fh.freq = infer_freq(y)
      if fh_type == "int":
          assert is_integer_index(fh.to_pandas())
      else:
          assert isinstance(
              fh.to_pandas(), INDEX_TYPE_LOOKUP.get(fh_type)
          )
  
      # get expected outputs
      if isinstance(steps, int):
          steps = np.array([steps])
      elif isinstance(steps, pd.Timedelta):
          steps = pd.Index([steps])
      else:
          steps = pd.Index(steps)
  
      if steps.dtype in int_types:
          fh_relative = pd.Index(steps, dtype="int64").sort_values()
          fh_absolute = y.index[
              np.where(y.index == cutoff)[0] + steps
          ].sort_values()
          fh_indexer = fh_relative - 1
      else:
          fh_relative = steps.sort_values()
          fh_absolute = (cutoff + steps).sort_values()
          fh_indexer = None
  
      if steps.dtype in int_types:
          null = 0
      else:
          null = pd.Timedelta(0)
      fh_oos = fh.to_pandas()[fh_relative > null]
      is_oos = len(fh_oos) == len(fh)
      fh_ins = fh.to_pandas()[fh_relative <= null]
      is_ins = len(fh_ins) == len(fh)
  
      # check outputs
      # check relative representation
      _assert_index_equal(fh_absolute, fh.to_absolute_index(cutoff))
      assert not fh.to_absolute(cutoff).is_relative
  
      # check relative representation
      _assert_index_equal(
          fh_relative, fh.to_relative(cutoff).to_pandas()
      )
      assert fh.to_relative(cutoff).is_relative
  
      if steps.dtype in int_types:
          # check index-like representation
          _assert_index_equal(fh_indexer, fh.to_indexer(cutoff))
      else:
          with pytest.raises(NotImplementedError):
              fh.to_indexer(cutoff)
  
      # check in-sample representation
      # we only compare the numpy array here because the expected solution is
      # formatted in a slightly different way than the generated solution
      np.testing.assert_array_equal(
          fh_ins.to_numpy(), fh.to_in_sample(cutoff).to_pandas()
      )
      assert fh.to_in_sample(cutoff).is_relative == is_relative
      assert fh.is_all_in_sample(cutoff) == is_ins
  
      # check out-of-sample representation
      np.testing.assert_array_equal(
          fh_oos.to_numpy(), fh.to_out_of_sample(cutoff).to_pandas()
      )
      assert fh.to_out_of_sample(cutoff).is_relative == is_relative
      assert fh.is_all_out_of_sample(cutoff) == is_oos
  
imports: from datetime import timedelta
  import numpy
  import pandas
  import pytest
  from numpy.testing._private.utils import assert_array_equal
  from pytest import raises
  from sktime.datasets import load_airline
  from sktime.datatypes._utilities import get_cutoff
  from sktime.forecasting.arima import AutoARIMA
  from sktime.forecasting.base import ForecastingHorizon
  from sktime.forecasting.base._fh import DELEGATED_METHODS, _check_freq, _extract_freq_from_cutoff
  from sktime.forecasting.ets import AutoETS
  from sktime.forecasting.exp_smoothing import ExponentialSmoothing
  from sktime.forecasting.naive import NaiveForecaster
  from sktime.forecasting.tests._config import INDEX_TYPE_LOOKUP, TEST_FHS, TEST_FHS_TIMEDELTA, VALID_INDEX_FH_COMBINATIONS
  from sktime.split import temporal_train_test_split
  from sktime.tests.test_switch import run_test_for_class
  from sktime.utils._testing.forecasting import _make_fh, make_forecasting_problem
  from sktime.utils._testing.series import _make_index, _make_series
  from sktime.utils.datetime import _coerce_duration_to_int, _get_duration, _get_freq, _get_intervals_count_and_unit, _shift, infer_freq
  from sktime.utils.validation.series import is_in_valid_index_types, is_integer_index
label_desc: Use image node_id 2 for calling a global function with example usage: test_fh(index_type, fh_type, is_relative, steps) without return types