code: def test_w_robust_search_space_univariate(self) -> None:
      # Check that if no transforms are needed, it is untouched.
      for multivariate in (True, False):
          rss = get_robust_search_space(
              multivariate=multivariate,
              lb=self.target_lb,
              ub=self.target_ub,
          )
          expected = str(rss)
          t = self.transform_class(
              search_space=rss,
              observations=[],
          )
          self.assertEqual(expected, str(t.transform_search_space(rss)))
      # Error if distribution is multiplicative.
      rss = get_robust_search_space()
      rss.parameter_distributions[0].multiplicative = True
      t = self.transform_class(
          search_space=rss,
          observations=[],
      )
      with self.assertRaisesRegex(
          NotImplementedError, "multiplicative"
      ):
          t.transform_search_space(rss)
      # Correctly transform univariate additive distributions.
      rss = get_robust_search_space(lb=5.0, ub=10.0)
      t = self.transform_class(
          search_space=rss,
          observations=[],
      )
      t.transform_search_space(rss)
      dists = rss.parameter_distributions
      self.assertEqual(
          dists[0].distribution_parameters["loc"],
          0.2 * self.target_range,
      )
      self.assertEqual(
          dists[0].distribution_parameters["scale"], self.target_range
      )
      self.assertEqual(dists[1].distribution_parameters["loc"], 0.0)
      self.assertEqual(
          dists[1].distribution_parameters["scale"],
          0.2 * self.target_range,
      )
      # Correctly transform environmental distributions.
      rss = get_robust_search_space(lb=5.0, ub=10.0)
      all_parameters = list(rss.parameters.values())
      rss = RobustSearchSpace(
          parameters=all_parameters[1:],
          parameter_distributions=rss.parameter_distributions[:1],
          num_samples=rss.num_samples,
          environmental_variables=all_parameters[:1],
      )
      t.transform_search_space(rss)
      dist = rss.parameter_distributions[0]
      self.assertEqual(
          dist.distribution_parameters["loc"],
          t._normalize_value(1.0, (5.0, 10.0)),
      )
      self.assertEqual(
          dist.distribution_parameters["scale"], self.target_range
      )
      # Error if transform via loc / scale is not supported.
      rss = get_robust_search_space(use_discrete=True)
      rss.parameters["z"]._parameter_type = ParameterType.FLOAT
      t = self.transform_class(
          search_space=rss,
          observations=[],
      )
      with self.assertRaisesRegex(
          UnsupportedError, "`loc` and `scale`"
      ):
          t.transform_search_space(rss)
  
file_path: Ax/ax/modelbridge/transforms/tests/test_unit_x_transform.py
imports: from copy import deepcopy
  import numpy
  from ax.core.observation import ObservationFeatures
  from ax.core.parameter import ChoiceParameter, ParameterType, RangeParameter
  from ax.core.parameter_constraint import ParameterConstraint
  from ax.core.search_space import RobustSearchSpace, SearchSpace
  from ax.exceptions.core import UnsupportedError, UserInputError
  from ax.modelbridge.transforms.unit_x import UnitX
  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 UnitXTransformTest obj's underlying member method code with example usage: obj.test_w_robust_search_space_univariate() without return types