code: def test_fit(self, mock_init: Mock) -> None:
      # pyre-fixme[20]: Argument `model` expected.
      ma = DiscreteModelBridge()
      ma._training_data = self.observations
      model = mock.create_autospec(DiscreteModel, instance=True)
      ma._fit(model, self.search_space, self.observations)
      self.assertEqual(ma.parameters, ["x", "y", "z"])
      self.assertEqual(sorted(ma.outcomes), ["a", "b"])
      Xs = {
          "a": [[0, "foo", True], [1, "foo", True], [1, "bar", True]],
          "b": [[0, "foo", True], [1, "foo", True]],
      }
      Ys = {"a": [[1.0], [2.0], [3.0]], "b": [[-1.0], [-2.0]]}
      Yvars = {"a": [[1.0], [2.0], [3.0]], "b": [[6.0], [7.0]]}
      parameter_values = [[0.0, 1.0], ["foo", "bar"], [True]]
      model_fit_args = model.fit.mock_calls[0][2]
      for i, x in enumerate(model_fit_args["Xs"]):
          self.assertEqual(x, Xs[ma.outcomes[i]])
      for i, y in enumerate(model_fit_args["Ys"]):
          self.assertEqual(y, Ys[ma.outcomes[i]])
      for i, v in enumerate(model_fit_args["Yvars"]):
          self.assertEqual(v, Yvars[ma.outcomes[i]])
      self.assertEqual(
          model_fit_args["parameter_values"], parameter_values
      )
  
      sq_obs = Observation(
          features=ObservationFeatures({}),
          data=self.observation_data[0],
      )
      with self.assertRaises(ValueError):
          ma._fit(
              model, self.search_space, self.observations + [sq_obs]
          )
  
imports: from unittest import mock
  from unittest.mock import Mock
  import numpy
  from ax.core.metric import Metric
  from ax.core.objective import Objective
  from ax.core.observation import Observation, ObservationData, ObservationFeatures
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.outcome_constraint import ComparisonOp, OutcomeConstraint
  from ax.core.parameter import ChoiceParameter, FixedParameter, ParameterType, RangeParameter
  from ax.core.search_space import SearchSpace
  from ax.exceptions.core import UserInputError
  from ax.modelbridge.discrete import _get_parameter_values, DiscreteModelBridge
  from ax.models.discrete_base import DiscreteModel
  from ax.utils.common.testutils import TestCase
label_desc: Use image node_id 2 for calling the DiscreteModelBridgeTest obj's underlying member method code with example usage: obj.test_fit(mock_init) without return types