code: def test_bayesian_search_forecaster_ValueError_when_engine_not_optuna():
      """
      Test ValueError in bayesian_search_forecaster is raised when engine
      is not 'optuna'.
      """
      forecaster = ForecasterAutoreg(
          regressor=Ridge(random_state=123), lags=2
      )
  
      def search_space(trial):  # pragma: no cover
          search_space = {
              "alpha": trial.suggest_float("alpha", 1e-2, 1.0)
          }
          return search_space
  
      engine = "not_optuna"
  
      err_msg = re.escape(
          f"""`engine` only allows 'optuna', got {engine}."""
      )
      with pytest.raises(ValueError, match=err_msg):
          bayesian_search_forecaster(
              forecaster=forecaster,
              y=y,
              lags_grid=[2, 4],
              search_space=search_space,
              steps=3,
              metric="mean_absolute_error",
              refit=True,
              initial_train_size=len(y[:-12]),
              fixed_train_size=True,
              n_trials=10,
              random_state=123,
              return_best=False,
              verbose=False,
              engine=engine,
          )
  
file_path: skforecast/skforecast/model_selection/tests/test_bayesian_search_forecaster.py
imports: import re
  import pytest
  import numpy
  import pandas
  from sklearn.linear_model import Ridge
  from skforecast.ForecasterAutoreg import ForecasterAutoreg
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from skforecast.model_selection import bayesian_search_forecaster
  from .fixtures_model_selection import y
label_desc: Use image node_id 3 for calling a global function with example usage: test_bayesian_search_forecaster_ValueError_when_engine_not_optuna() and returns: search_space