code: def test_evaluate_bayesian_search_skopt_when_return_best():  # pragma: no cover
      """
      Test forecaster is refitted when return_best=True in _bayesian_search_skopt.
      """
      forecaster = ForecasterAutoreg(
          regressor=Ridge(random_state=123),
          lags=2,  # Placeholder, the value will be overwritten
      )
  
      steps = 3
      n_validation = 12
      y_train = y[:-n_validation]
      lags_grid = [2, 4]
      search_space = {
          "alpha": Real(0.01, 1.0, "log-uniform", name="alpha")
      }
  
      _bayesian_search_skopt(
          forecaster=forecaster,
          y=y,
          lags_grid=lags_grid,
          search_space=search_space,
          steps=steps,
          metric="mean_absolute_error",
          refit=True,
          initial_train_size=len(y_train),
          fixed_train_size=True,
          n_trials=10,
          random_state=123,
          return_best=True,
          verbose=False,
      )
  
      expected_lags = np.array([1, 2])
      expected_alpha = 0.019050287104581624
  
      assert (expected_lags == forecaster.lags).all()
      assert expected_alpha == approx(
          forecaster.regressor.alpha, abs=0.00001
      )
  
imports: import re
  import pytest
  import numpy
  import pandas
  import sys
  from pytest import approx
  from importlib import metadata
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.linear_model import Ridge
  from sklearn.metrics import mean_absolute_error
  from skforecast.ForecasterAutoreg import ForecasterAutoreg
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from skforecast.model_selection import backtesting_forecaster
  from .fixtures_model_selection import y
  from tqdm import tqdm
  from functools import partialmethod
label_desc: Use image node_id 7 for calling a global function with example usage: test_evaluate_bayesian_search_skopt_when_return_best() without return types