code: def test_w_robust_search_space(self) -> None:
      rss = get_robust_search_space()
      # Transform a non-distributional parameter.
      t = IntRangeToChoice(
          search_space=rss,
          observations=[],
      )
      rss_new = t.transform_search_space(rss)
      # Make sure that the return value is still a RobustSearchSpace.
      self.assertIsInstance(rss_new, RobustSearchSpace)
      self.assertEqual(
          set(rss.parameters.keys()), set(rss_new.parameters.keys())
      )
      # pyre-fixme[16]: `SearchSpace` has no attribute `parameter_distributions`.
      self.assertEqual(
          rss.parameter_distributions, rss_new.parameter_distributions
      )
      self.assertIsInstance(
          rss_new.parameters.get("z"), ChoiceParameter
      )
      # Test with environmental variables.
      all_params = list(rss.parameters.values())
      rss = RobustSearchSpace(
          parameters=all_params[2:],
          parameter_distributions=rss.parameter_distributions,
          num_samples=rss.num_samples,
          environmental_variables=all_params[:2],
      )
      t = IntRangeToChoice(
          search_space=rss,
          observations=[],
      )
      rss_new = t.transform_search_space(rss)
      self.assertIsInstance(rss_new, RobustSearchSpace)
      self.assertEqual(
          set(rss.parameters.keys()), set(rss_new.parameters.keys())
      )
      self.assertEqual(
          rss.parameter_distributions, rss_new.parameter_distributions
      )
      # pyre-fixme[16]: `SearchSpace` has no attribute `_environmental_variables`.
      self.assertEqual(
          rss._environmental_variables, rss_new._environmental_variables
      )
      self.assertIsInstance(
          rss_new.parameters.get("z"), ChoiceParameter
      )
      # Error with distributional parameter.
      rss = get_robust_search_space(use_discrete=True)
      t = IntRangeToChoice(
          search_space=rss,
          observations=[],
      )
      with self.assertRaisesRegex(
          UnsupportedError, "transform is not supported"
      ):
          t.transform_search_space(rss)
  
file_path: Ax/ax/modelbridge/transforms/tests/test_int_range_to_choice_transform.py
imports: from copy import deepcopy
  from ax.core.observation import ObservationFeatures
  from ax.core.parameter import ChoiceParameter, ParameterType, RangeParameter
  from ax.core.search_space import RobustSearchSpace, SearchSpace
  from ax.exceptions.core import UnsupportedError
  from ax.modelbridge.transforms.int_range_to_choice import IntRangeToChoice
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.core_stubs import get_robust_search_space
label_desc: Use image node_id 5 for calling the IntRangeToChoiceTransformTest obj's underlying member method code with example usage: obj.test_w_robust_search_space() without return types