code: def test_attach_batch_trial_data(self) -> None:
      # Verify components before we attach trial data
      self.assertEqual(2, len(self.batch.arms))
      arm1_name = self.batch.arms[0].name
      arm2_name = self.batch.arms[1].name
  
      self.assertEqual(
          2,
          len(self.batch.experiment.metrics)
          - len(self.batch.experiment.tracking_metrics),
      )
      self.assertTrue("m1" in self.batch.experiment.metrics)
      self.assertTrue("m2" in self.batch.experiment.metrics)
  
      data = self.batch.lookup_data().df.to_dict(orient="index")
      self.assertTrue(len(data) == 0)
  
      # Attach data
      self.batch.attach_batch_trial_data(
          raw_data={
              arm1_name: {"m1": 1.0, "m2": 2.0},
              arm2_name: {"m1": 3.0, "m2": 4.0},
          }
      )
  
      # Confirm the expected state after attaching data
      data = (
          self.batch.lookup_data()
          .df.set_index(["arm_name", "metric_name"])
          .to_dict(orient="index")
      )
  
      self.assertEqual(1.0, data[(arm1_name, "m1")]["mean"])
      self.assertEqual(2.0, data[(arm1_name, "m2")]["mean"])
      self.assertEqual(3.0, data[(arm2_name, "m1")]["mean"])
      self.assertEqual(4.0, data[(arm2_name, "m2")]["mean"])
  
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 28 for calling the BatchTrialTest obj's underlying member method code with example usage: obj.test_attach_batch_trial_data() without return types