code: def test_AbandonArm(self) -> None:
      arm = self.batch.arms[0]
      reason = "Bad arm"
      self.batch.mark_arm_abandoned(arm.name, reason)
      self.assertEqual(len(self.batch.abandoned_arms), 1)
      self.assertEqual(self.batch.abandoned_arms[0], arm)
  
      self.assertEqual(len(self.batch.abandoned_arms_metadata), 1)
      metadata = self.batch.abandoned_arms_metadata[0]
      self.assertEqual(metadata.reason, reason)
      self.assertEqual(metadata.name, arm.name)
  
      # Fail to abandon arm not in BatchTrial
      with self.assertRaises(ValueError):
          self.batch.mark_arm_abandoned(
              Arm(parameters={"x": 3, "y": "fooz", "z": False})
          )
  
imports: import math
  from time import sleep
  from unittest import mock
  from unittest.mock import patch, PropertyMock
  import numpy
  from ax.core.arm import Arm
  from ax.core.base_trial import TrialStatus
  from ax.core.batch_trial import BatchTrial, GeneratorRunStruct
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun, GeneratorRunType
  from ax.core.parameter import FixedParameter, ParameterType
  from ax.core.search_space import SearchSpace
  from ax.runners.synthetic import SyntheticRunner
  from ax.utils.common.testutils import TestCase
  from ax.utils.common.typeutils import checked_cast
  from ax.utils.testing.core_stubs import get_abandoned_arm, get_arm, get_arm_weights1, get_arms, get_experiment, get_generator_run, get_generator_run2, get_weights
label_desc: Use image node_id 17 for calling the BatchTrialTest obj's underlying member method code with example usage: obj.test_AbandonArm() without return types