code: def test_adding_new_trials(self) -> None:
      new_arm = get_arms()[1]
      cand_metadata = {new_arm.signature: {"a": "b"}}
      new_trial = self.experiment.new_trial(
          generator_run=GeneratorRun(
              arms=[new_arm],
              # pyre-fixme[6]: For 2nd param expected `Optional[Dict[str,
              #  Optional[Dict[str, typing.Any]]]]` but got `Dict[str, Dict[str,
              #  str]]`.
              candidate_metadata_by_arm_signature=cand_metadata,
          )
      )
      with self.assertRaises(ValueError):
          self.experiment.new_trial(
              generator_run=GeneratorRun(arms=get_arms())
          )
      self.assertEqual(
          new_trial.arms_by_name["1_0"].signature, new_arm.signature
      )
      with self.assertRaises(KeyError):
          self.trial.arms_by_name["1_0"]
      self.assertEqual(
          new_trial._get_candidate_metadata_from_all_generator_runs(),
          {"1_0": cand_metadata[new_arm.signature]},
      )
      self.assertEqual(
          new_trial._get_candidate_metadata("1_0"),
          cand_metadata[new_arm.signature],
      )
      self.assertRaises(
          ValueError,
          new_trial._get_candidate_metadata,
          "this_is_not_an_arm",
      )
  
imports: import itertools
  from copy import deepcopy
  from unittest import mock
  from unittest.mock import Mock, patch
  import pandas
  from ax.core.base_trial import BaseTrial, TrialStatus
  from ax.core.data import Data
  from ax.core.generator_run import GeneratorRun, GeneratorRunType
  from ax.core.runner import Runner
  from ax.exceptions.core import UserInputError
  from ax.runners.synthetic import SyntheticRunner
  from ax.utils.common.result import Ok
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.core_stubs import get_arms, get_branin_arms, get_experiment, get_objective, get_test_map_data_experiment
label_desc: Use image node_id 5 for calling the TrialTest obj's underlying member method code with example usage: obj.test_adding_new_trials() without return types