code: def test_train_do_optimize():
      # Check that do_optimize does not mess with the kernel hyperparameters given to the Gaussian process!
      seed = 1
      rs = np.random.RandomState(seed)
      X, Y, n_dims = get_cont_data(rs)
  
      model = get_gp(n_dims, seed)
      model._train(X[:10], Y[:10], optimize_hyperparameters=False)
      theta = model._kernel.theta
      theta_ = model._kernel.theta
      fixture = np.array(
          [
              0.693147,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              -6.907755,
          ]
      )
      np.testing.assert_array_almost_equal(theta, fixture)
      np.testing.assert_array_almost_equal(theta_, fixture)
      np.testing.assert_array_almost_equal(theta, theta_)
  
      model._train(X[:10], Y[:10], optimize_hyperparameters=True)
      theta = model._kernel.theta
      theta_ = model._kernel.theta
      fixture = np.array(
          [
              0.693147,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              0.0,
              -6.907755,
          ]
      )
      assert not np.any(theta == fixture)
      assert not np.any(theta_ == fixture)
      np.testing.assert_array_almost_equal(theta, theta_)
  
imports: from unittest.mock import patch
  import numpy
  import pytest
  import scipy.optimize
  import sklearn.datasets
  import sklearn.model_selection
  from ConfigSpace import CategoricalHyperparameter, ConfigurationSpace, EqualsCondition, UniformFloatHyperparameter
  from smac.model.gaussian_process.gaussian_process import GaussianProcess
  from smac.model.gaussian_process.priors import HorseshoePrior, LogNormalPrior
  from smac.utils.configspace import convert_configurations_to_array
label_desc: Use image node_id 7 for calling a global function with example usage: test_train_do_optimize() without return types