code: def test_output_evaluate_grid_hyperparameters_ForecasterAutoreg_lags_grid_is_None_with_mocked():
      """
      Test output of _evaluate_grid_hyperparameters in ForecasterAutoreg when
      `lags_grid` is None with mocked (mocked done in Skforecast v0.4.3),
      should use forecaster.lags as lags_grid.
      """
      forecaster = ForecasterAutoreg(
          regressor=Ridge(random_state=123), lags=2
      )
  
      steps = 3
      n_validation = 12
      y_train = y[:-n_validation]
      lags_grid = None
      param_grid = [{"alpha": 0.01}, {"alpha": 0.1}, {"alpha": 1}]
  
      results = _evaluate_grid_hyperparameters(
          forecaster=forecaster,
          y=y,
          lags_grid=lags_grid,
          param_grid=param_grid,
          steps=steps,
          refit=False,
          metric="mean_squared_error",
          initial_train_size=len(y_train),
          fixed_train_size=False,
          return_best=False,
          verbose=False,
      )
  
      expected_results = pd.DataFrame(
          {
              "lags": [[1, 2], [1, 2], [1, 2]],
              "params": [{"alpha": 0.01}, {"alpha": 0.1}, {"alpha": 1}],
              "mean_squared_error": np.array(
                  [0.06464646, 0.06502362, 0.06745534]
              ),
              "alpha": np.array([0.01, 0.1, 1.0]),
          },
          index=pd.RangeIndex(start=0, stop=3, step=1),
      )
  
      pd.testing.assert_frame_equal(results, expected_results)
  
imports: import re
  import pytest
  import numpy
  import pandas
  from sklearn.linear_model import Ridge
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_absolute_percentage_error
  from skforecast.ForecasterAutoreg import ForecasterAutoreg
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from skforecast.model_selection.model_selection import _evaluate_grid_hyperparameters
  from tqdm import tqdm
  from functools import partialmethod
  from .fixtures_model_selection import y
label_desc: Use image node_id 8 for calling a global function with example usage: test_output_evaluate_grid_hyperparameters_ForecasterAutoreg_lags_grid_is_None_with_mocked() without return types