code: def test_set_out_sample_residuals_when_residuals_length_is_more_than_1000_and_append():
      """
      Test residuals stored when new residuals length is more than 1000 and append is True.
      """
      forecaster = ForecasterAutoreg(LinearRegression(), lags=3)
      forecaster.set_out_sample_residuals(residuals=np.arange(10))
      forecaster.set_out_sample_residuals(
          residuals=np.arange(1000), append=True
      )
      expected = np.hstack([np.arange(10), np.arange(1200)])[:1000]
      results = forecaster.out_sample_residuals
  
      assert (results == expected).all()
  
file_path: skforecast/skforecast/ForecasterAutoreg/tests/test_set_out_sample_residuals.py
imports: import re
  import pytest
  import numpy
  import pandas
  from skforecast.ForecasterAutoreg import ForecasterAutoreg
  from sklearn.linear_model import LinearRegression
  from sklearn.preprocessing import StandardScaler
label_desc: Use image node_id 8 for calling a global function with example usage: test_set_out_sample_residuals_when_residuals_length_is_more_than_1000_and_append() without return types