code: def test_Init(self) -> None:
      config1 = OptimizationConfig(
          objective=self.objective,
          outcome_constraints=self.outcome_constraints,
      )
      self.assertEqual(str(config1), OC_STR)
      with self.assertRaises(ValueError):
          config1.objective = (
              self.alt_objective
          )  # constrained Objective.
      # updating constraints is fine.
      config1.outcome_constraints = [self.outcome_constraint]
      self.assertEqual(len(config1.metrics), 2)
  
      # objective without outcome_constraints is also supported
      config2 = OptimizationConfig(objective=self.objective)
      self.assertEqual(config2.outcome_constraints, [])
  
      # setting objective is fine too, if it's compatible with constraints..
      config2.objective = self.m2_objective
      # setting constraints on objectives is fine for MultiObjective components.
  
      config2.outcome_constraints = self.outcome_constraints
      self.assertEqual(
          config2.outcome_constraints, self.outcome_constraints
      )
  
      # Risk measure is correctly registered.
      self.assertIsNone(config2.risk_measure)
      config3 = OptimizationConfig(
          objective=self.objective,
          outcome_constraints=self.outcome_constraints,
          risk_measure=self.single_output_risk_measure,
      )
      expected_str = (
          OC_STR[:-1]
          + ", risk_measure=RiskMeasure(risk_measure=Expectation, "
          "options={'n_w': 2}))"
      )
      self.assertEqual(str(config3), expected_str)
      self.assertIs(
          config3.risk_measure, self.single_output_risk_measure
      )
  
imports: from ax.core.metric import Metric
  from ax.core.objective import MultiObjective, Objective, ScalarizedObjective
  from ax.core.optimization_config import _NO_RISK_MEASURE, MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.outcome_constraint import ObjectiveThreshold, OutcomeConstraint, ScalarizedOutcomeConstraint
  from ax.core.risk_measures import RiskMeasure
  from ax.core.types import ComparisonOp
  from ax.exceptions.core import UserInputError
  from ax.utils.common.testutils import TestCase
label_desc: Use image node_id 2 for calling the OptimizationConfigTest obj's underlying member method code with example usage: obj.test_Init() without return types