code: def test_NormalizedArmWeights(self) -> None:
      new_batch_trial = self.experiment.new_batch_trial()
      parameterizations = [
          {"w": 0.75, "x": 1, "y": "foo", "z": True},
          {"w": 0.77, "x": 2, "y": "foo", "z": True},
      ]
      # pyre-fixme[6]: For 1st param expected `Dict[str, Union[None, bool, float,
      #  int, str]]` but got `Dict[str, Union[float, str]]`.
      arms = [
          Arm(parameters=p) for i, p in enumerate(parameterizations)
      ]
      new_batch_trial.add_arms_and_weights(arms=arms, weights=[2, 1])
  
      # test normalizing to 1
      arm_weights = new_batch_trial.normalized_arm_weights()
      # self.assertEqual(list(arm_weights.keys()), arms)
      batch_arm_parameters = [
          arm.parameters for arm in list(arm_weights.keys())
      ]
      arm_parameters = [arm.parameters for arm in arms]
      self.assertEqual(batch_arm_parameters, arm_parameters)
      self.assertTrue(
          np.allclose(list(arm_weights.values()), [2 / 3, 1 / 3])
      )
  
      # test normalizing to 100
      arm_weights = new_batch_trial.normalized_arm_weights(total=100)
      batch_arm_parameters = [
          arm.parameters for arm in list(arm_weights.keys())
      ]
      arm_parameters = [arm.parameters for arm in arms]
      self.assertEqual(batch_arm_parameters, arm_parameters)
      self.assertTrue(
          np.allclose(list(arm_weights.values()), [200 / 3, 100 / 3])
      )
  
      # test normalizing with truncation
      arm_weights = new_batch_trial.normalized_arm_weights(
          total=1, trunc_digits=2
      )
      batch_arm_parameters = [
          arm.parameters for arm in list(arm_weights.keys())
      ]
      arm_parameters = [arm.parameters for arm in arms]
      self.assertEqual(batch_arm_parameters, arm_parameters)
      self.assertTrue(
          np.allclose(list(arm_weights.values()), [0.67, 0.33])
      )
  
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 21 for calling the BatchTrialTest obj's underlying member method code with example usage: obj.test_NormalizedArmWeights() without return types