code: def test_set_out_sample_residuals_when_transform_is_True():
      """
      Test residuals stored when using a StandardScaler() as transformer.
      """
  
      forecaster = ForecasterAutoregCustom(
          regressor=LinearRegression(),
          fun_predictors=create_predictors,
          window_size=5,
          transformer_y=StandardScaler(),
      )
      y = pd.Series(
          np.array(
              [
                  12.5,
                  10.3,
                  9.9,
                  10.4,
                  9.9,
                  8.5,
                  10.6,
                  11.4,
                  10.0,
                  9.5,
                  10.1,
                  11.5,
                  11.4,
                  11.3,
                  10.5,
                  9.6,
                  10.4,
                  11.7,
                  8.7,
                  10.6,
              ]
          )
      )
      forecaster.fit(y=y)
      new_residuals = np.random.normal(size=100)
      new_residuals_transformed = forecaster.transformer_y.transform(
          new_residuals.reshape(-1, 1)
      )
      new_residuals_transformed = new_residuals_transformed.flatten()
      forecaster.set_out_sample_residuals(
          residuals=new_residuals, transform=True
      )
  
      np.testing.assert_array_equal(
          new_residuals_transformed, forecaster.out_sample_residuals
      )
  
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 10 for calling a global function with example usage: test_set_out_sample_residuals_when_transform_is_True() without return types