code: def test_compute_model_dependencies(
      self,
      mock_expand: Mock,
      mock_project: Mock,
      mock_inverse_utility: Mock,
      mock_affine_model: Mock,
      mock_Acquisition_compute: Mock,
  ) -> None:
      # TODO: Patch only `MFKG_PATH.__init__` once `construct_inputs`
      # implemented for qMFKG.
      with patch(
          f"{MULTI_FIDELITY_PATH}.MultiFidelityAcquisition.__init__",
          return_value=None,
      ):
          # We don't actually need to instantiate the BoTorch acqf in these tests.
          mf_acquisition = MultiFidelityAcquisition(
              surrogates={"regression": self.surrogate},
              search_space_digest=self.search_space_digest,
              torch_opt_config=TorchOptConfig(
                  objective_weights=self.objective_weights
              ),
              botorch_acqf_class=qMultiFidelityKnowledgeGradient,
          )
      # Raise Error if `fidelity_weights` and `target_fidelities` do not align.
      with self.assertRaisesRegex(
          RuntimeError, "Must provide the same indices"
      ):
          mf_acquisition.compute_model_dependencies(
              surrogates={"regression": self.surrogate},
              search_space_digest=dataclasses.replace(
                  self.search_space_digest,
                  fidelity_features=[1],
                  target_values={1: 5.0},
              ),
              torch_opt_config=self.torch_opt_config,
              options=self.options,
          )
      # Make sure `fidelity_weights` are set when they are not passed in.
      mf_acquisition.compute_model_dependencies(
          surrogates={"regression": self.surrogate},
          search_space_digest=dataclasses.replace(
              self.search_space_digest,
              fidelity_features=[2, 3],
              target_values={2: 5.0, 3: 5.0},
          ),
          torch_opt_config=self.torch_opt_config,
          options={
              Keys.COST_INTERCEPT: 1.0,
              Keys.NUM_TRACE_OBSERVATIONS: 0,
          },
      )
      mock_affine_model.assert_called_with(
          fidelity_weights={2: 1.0, 3: 1.0}, fixed_cost=1.0
      )
      # Usual case.
      dependencies = mf_acquisition.compute_model_dependencies(
          surrogates={"regression": self.surrogate},
          search_space_digest=self.search_space_digest,
          torch_opt_config=self.torch_opt_config,
          options=self.options,
      )
      mock_Acquisition_compute.assert_called_with(
          surrogates={"regression": self.surrogate},
          search_space_digest=self.search_space_digest,
          torch_opt_config=self.torch_opt_config,
          options=self.options,
      )
      mock_affine_model.assert_called_with(
          fidelity_weights=self.options[Keys.FIDELITY_WEIGHTS],
          fixed_cost=self.options[Keys.COST_INTERCEPT],
      )
      mock_inverse_utility.assert_called_with(cost_model="cost_model")
      self.assertTrue(Keys.COST_AWARE_UTILITY in dependencies)
      self.assertTrue(Keys.PROJECT in dependencies)
      self.assertTrue(Keys.EXPAND in dependencies)
      # Check that `project` and `expand` are defined correctly.
      project = dependencies.get(Keys.PROJECT)
      project(torch.tensor([1.0]))
      mock_project.assert_called_with(
          X=torch.tensor([1.0]),
          target_fidelities=self.search_space_digest.target_values,
      )
      expand = dependencies.get(Keys.EXPAND)
      expand(torch.tensor([1.0]))
      mock_expand.assert_called_with(
          X=torch.tensor([1.0]),
          fidelity_dims=sorted(self.search_space_digest.target_values),
          num_trace_obs=self.options.get(Keys.NUM_TRACE_OBSERVATIONS),
      )
  
file_path: Ax/ax/models/torch/tests/test_multi_fidelity.py
imports: import dataclasses
  from unittest.mock import Mock, patch
  import torch
  from ax.core.search_space import SearchSpaceDigest
  from ax.models.torch.botorch_modular.acquisition import Acquisition
  from ax.models.torch.botorch_modular.multi_fidelity import MultiFidelityAcquisition
  from ax.models.torch.botorch_modular.surrogate import Surrogate
  from ax.models.torch_base import TorchOptConfig
  from ax.utils.common.constants import Keys
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.mock import fast_botorch_optimize
  from botorch.acquisition.knowledge_gradient import qMultiFidelityKnowledgeGradient
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.utils.datasets import SupervisedDataset
label_desc: Use image node_id 2 for calling the MultiFidelityAcquisitionTest obj's underlying member method code with example usage: obj.test_compute_model_dependencies(mock_expand, mock_project, mock_inverse_utility, mock_affine_model, mock_Acquisition_compute) without return types