code: def test_set_out_sample_residuals_warning_when_forecaster_has_transformer_and_transform_False():
      """
      Test Warning is raised when forecaster has a transformer_y and transform=False.
      """
      forecaster = ForecasterAutoregCustom(
          regressor=LinearRegression(),
          fun_predictors=create_predictors,
          window_size=5,
          transformer_y=StandardScaler(),
      )
      residuals = np.arange(10)
  
      err_msg = re.escape(
          (
              f"Argument `transform` is set to `False` but forecaster was trained "
              f"using a transformer {forecaster.transformer_y}. Ensure that the new residuals "
              f"are already transformed or set `transform=True`."
          )
      )
      with pytest.warns(UserWarning, match=err_msg):
          forecaster.set_out_sample_residuals(
              residuals=residuals, transform=False
          )
  
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 3 for calling a global function with example usage: test_set_out_sample_residuals_warning_when_forecaster_has_transformer_and_transform_False() without return types