code: def test_method(method, mro, allowed_method):
      # Test if the correct methods are called on the underlying steps. Use mocking here?
      pipeline = Pipeline()
      step_mock = MagicMock()
      step_mock.get_allowed_method.return_value = [allowed_method]
      pipeline._assembled = True
      pipeline.assembled_steps.update({"name": step_mock})
      pipeline._last_step_name = "name"
  
      x_data = MagicMock()
      y_data = MagicMock()
  
      getattr(pipeline, method)(X=x_data, y=y_data, additional_kwarg=42)
  
      assert pipeline.assembled_steps["X"].buffer == x_data
      assert pipeline.assembled_steps["y"].buffer == y_data
  
      step_mock.get_result.assert_called_with(
          fit=True if method == "fit" else False,
          mro=mro,
          required_method=None if method == "fit" else allowed_method,
          kwargs={"additional_kwarg": 42},
      )
  
file_path: sktime/sktime/pipeline/tests/test_pipeline.py
imports: from unittest.mock import MagicMock
  import pytest
  from sktime.classification.distance_based import KNeighborsTimeSeriesClassifier
  from sktime.datasets import load_longley
  from sktime.pipeline.pipeline import MethodNotImplementedError, Pipeline
  from sktime.transformations.series.boxcox import BoxCoxTransformer
  from sktime.transformations.series.exponent import ExponentTransformer
label_desc: Use image node_id 4 for calling a global function with example usage: test_method(method, mro, allowed_method) without return types