code: def test_add_generator_run(self) -> None:
      self.assertEqual(len(self.batch.arms), len(self.arms))
      self.assertEqual(len(self.batch.generator_run_structs), 1)
      self.assertEqual(sum(self.batch.weights), sum(self.weights))
  
      # Overwrite the GS index to not-None.
      self.batch._generation_step_index = 0
  
      # one of these arms already exists on the BatchTrial,
      # so we should just update its weight
      new_arms = [
          Arm(parameters={"w": 0.75, "x": 1, "y": "foo", "z": True}),
          Arm(parameters={"w": 1.4, "x": 5, "y": "bar", "z": False}),
      ]
      new_weights = [0.75, 0.25]
      gr = GeneratorRun(arms=new_arms, weights=new_weights)
      self.batch.add_generator_run(gr, 2.0)
  
      self.assertEqual(len(self.batch.arms), len(self.arms) + 1)
      self.assertEqual(len(self.batch.generator_run_structs), 2)
      self.assertEqual(sum(self.batch.weights), sum(self.weights) + 2)
      # Check the GS index was not overwritten to None.
      self.assertEqual(self.batch._generation_step_index, 0)
  
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 7 for calling the BatchTrialTest obj's underlying member method code with example usage: obj.test_add_generator_run() without return types