code: def test_MaxValueEntropySearch(self) -> None:
      model = MaxValueEntropySearch()
      model.fit(
          datasets=self.training_data,
          metric_names=self.metric_names,
          search_space_digest=self.search_space_digest,
      )
  
      # test model.gen()
      torch_opt_config = TorchOptConfig(
          objective_weights=self.objective_weights,
          model_gen_options={
              "acquisition_function_kwargs": self.acq_options,
          },
      )
      new_X_dummy = torch.rand(1, 1, 3, **self.tkwargs)
      with mock.patch(self.optimize_acqf) as mock_optimize_acqf:
          mock_optimize_acqf.side_effect = [(new_X_dummy, None)]
          gen_results = model.gen(
              n=1,
              search_space_digest=self.search_space_digest,
              torch_opt_config=torch_opt_config,
          )
          self.assertTrue(
              torch.equal(gen_results.points, new_X_dummy.cpu())
          )
          self.assertTrue(
              torch.equal(
                  gen_results.weights,
                  torch.ones(1, dtype=self.tkwargs["dtype"]),
              )
          )
          mock_optimize_acqf.assert_called_once()
  
      # Check best point selection within bounds (some numerical tolerance)
      xbest = model.best_point(
          search_space_digest=self.search_space_digest,
          torch_opt_config=torch_opt_config,
      )
      lb = torch.tensor([b[0] for b in self.bounds]) - 1e-5
      ub = torch.tensor([b[1] for b in self.bounds]) + 1e-5
      self.assertTrue(torch.all(xbest <= ub))
      self.assertTrue(torch.all(xbest >= lb))
  
      # test error message in case of constraints
      linear_constraints = (
          torch.tensor([[0.0, 0.0, 0.0], [0.0, 1.0, 0.0]]),
          torch.tensor([[0.5], [1.0]]),
      )
      with self.assertRaises(UnsupportedError):
          model.gen(
              n=1,
              search_space_digest=self.search_space_digest,
              torch_opt_config=dataclasses.replace(
                  torch_opt_config,
                  linear_constraints=linear_constraints,
              ),
          )
  
      # test error message in case of >1 objective weights
      objective_weights = torch.tensor([1.0, 1.0], **self.tkwargs)
      with self.assertRaises(UnsupportedError):
          model.gen(
              n=1,
              search_space_digest=self.search_space_digest,
              torch_opt_config=dataclasses.replace(
                  torch_opt_config, objective_weights=objective_weights
              ),
          )
  
      # test error message in best_point()
      with self.assertRaises(UnsupportedError):
          model.best_point(
              search_space_digest=self.search_space_digest,
              torch_opt_config=dataclasses.replace(
                  torch_opt_config,
                  linear_constraints=linear_constraints,
              ),
          )
  
      with self.assertRaises(RuntimeError):
          model.best_point(
              search_space_digest=dataclasses.replace(
                  self.search_space_digest,
                  fidelity_features=[2],
                  target_values={2: 1.0},
              ),
              torch_opt_config=torch_opt_config,
          )
      # test input warping
      self.assertFalse(model.use_input_warping)
      model = MaxValueEntropySearch(use_input_warping=True)
      model.fit(
          datasets=self.training_data,
          metric_names=self.metric_names,
          search_space_digest=self.search_space_digest,
      )
      self.assertTrue(model.use_input_warping)
      self.assertTrue(hasattr(model.model, "input_transform"))
      self.assertIsInstance(model.model.input_transform, Warp)
  
      # test loocv pseudo likelihood
      self.assertFalse(model.use_loocv_pseudo_likelihood)
      model = MaxValueEntropySearch(use_loocv_pseudo_likelihood=True)
      model.fit(
          datasets=self.training_data,
          metric_names=self.metric_names,
          search_space_digest=self.search_space_digest,
      )
      self.assertTrue(model.use_loocv_pseudo_likelihood)
  
file_path: Ax/ax/models/tests/test_botorch_mes.py
imports: import dataclasses
  from typing import Any, Dict
  from unittest import mock
  import torch
  from ax.core.search_space import SearchSpaceDigest
  from ax.models.torch.botorch_mes import _instantiate_MES, MaxValueEntropySearch
  from ax.models.torch_base import TorchOptConfig
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.mock import fast_botorch_optimize
  from botorch.acquisition.max_value_entropy_search import qMaxValueEntropy, qMultiFidelityMaxValueEntropy
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.transforms.input import Warp
  from botorch.sampling.normal import SobolQMCNormalSampler
  from botorch.utils.datasets import SupervisedDataset
label_desc: Use image node_id 2 for calling the MaxValueEntropySearchTest obj's underlying member method code with example usage: obj.test_MaxValueEntropySearch() without return types