code: def test_bagging_forecaster_transformer_type_error(transformer):
      """Test that the right exception is raised for invalid transformer."""
      y = load_airline()
  
      with pytest.raises(TypeError) as ex:
          f = BaggingForecaster(
              bootstrap_transformer=transformer,
              forecaster=NaiveForecaster(sp=12),
          )
          f.fit(y)
          msg = (
              "bootstrap_transformer in BaggingForecaster should be a Transformer "
              "that take as input a Series and output a Panel."
          )
          assert msg == ex.value
  
file_path: sktime/sktime/forecasting/compose/tests/test_bagging.py
imports: import pandas
  import pytest
  from sktime.datasets import load_airline
  from sktime.forecasting.compose import BaggingForecaster
  from sktime.forecasting.naive import NaiveForecaster
  from sktime.tests.test_switch import run_test_for_class
  from sktime.transformations.bootstrap import STLBootstrapTransformer
  from sktime.transformations.series.boxcox import LogTransformer
label_desc: Use image node_id 1 for calling a global function with example usage: test_bagging_forecaster_transformer_type_error(transformer) without return types