code: def test_set_out_sample_residuals_warning_when_forecaster_has_transformer_and_transform_True():
      """
      Test Warning is raised when forecaster has a transformer_y and transform=True.
      """
      forecaster = ForecasterAutoregCustom(
          regressor=LinearRegression(),
          fun_predictors=create_predictors,
          window_size=5,
          transformer_y=StandardScaler(),
      )
      forecaster.fit(y=pd.Series(np.arange(10)))
      residuals = np.arange(10)
  
      err_msg = re.escape(
          (
              f"Residuals will be transformed using the same transformer used "
              f"when training the forecaster ({forecaster.transformer_y}). Ensure that the "
              f"new residuals are on the same scale as the original time series."
          )
      )
      with pytest.warns(UserWarning, match=err_msg):
          forecaster.set_out_sample_residuals(
              residuals=residuals, transform=True
          )
  
file_path: skforecast/skforecast/ForecasterAutoregCustom/tests/test_set_out_sample_residuals.py
imports: import re
  import pytest
  import numpy
  import pandas
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from sklearn.linear_model import LinearRegression
  from sklearn.preprocessing import StandardScaler
label_desc: Use image node_id 4 for calling a global function with example usage: test_set_out_sample_residuals_warning_when_forecaster_has_transformer_and_transform_True() without return types