code: def test_Init(self) -> None:
      with self.assertRaises(ValueError):
          ScalarizedObjective(
              metrics=[self.metrics["m1"], self.metrics["m2"]],
              weights=[1.0],
          )
      with self.assertRaisesRegex(
          ValueError,
          "Metric with name m2 specifies `lower_is_better` = "
          "True, which doesn't match the specified optimization direction.",
      ):
          # Should fail since m2 specifies lower_is_better=True
          ScalarizedObjective(
              metrics=[self.metrics["m1"], self.metrics["m2"]],
              minimize=False,
          )
      warnings.resetwarnings()
      warnings.simplefilter("always", append=True)
      with warnings.catch_warnings(record=True) as ws:
          Objective(metric=self.metrics["m1"])
          self.assertTrue(
              any(
                  issubclass(w.category, DeprecationWarning) for w in ws
              )
          )
          self.assertTrue(
              any(
                  "Defaulting to `minimize=False`" in str(w.message)
                  for w in ws
              )
          )
      with warnings.catch_warnings(record=True) as ws:
          Objective(
              Metric(name="m4", lower_is_better=True), minimize=False
          )
          self.assertTrue(
              any(
                  "Attempting to maximize" in str(w.message) for w in ws
              )
          )
      with warnings.catch_warnings(record=True) as ws:
          Objective(
              Metric(name="m4", lower_is_better=False), minimize=True
          )
          self.assertTrue(
              any(
                  "Attempting to minimize" in str(w.message) for w in ws
              )
          )
      self.assertEqual(
          self.objective.get_unconstrainable_metrics(),
          [self.metrics["m1"]],
      )
  
file_path: Ax/ax/core/tests/test_objective.py
imports: import warnings
  from ax.core.metric import Metric
  from ax.core.objective import MultiObjective, Objective, ScalarizedObjective
  from ax.utils.common.testutils import TestCase
label_desc: Use image node_id 2 for calling the ObjectiveTest obj's underlying member method code with example usage: obj.test_Init() without return types