code: def test_instrumentation() -> None:
      instru = p.Instrumentation(
          p.Scalar(),
          3,
          b=p.Choice([0, 1, 2, 3]),
          a=p.TransitionChoice([0, 1, 2, 3]),
      )
      np.testing.assert_equal(instru.dimension, 6)
      instru2 = p.Instrumentation(
          p.Scalar(),
          3,
          b=p.Choice([0, 1, 2, 3]),
          a=p.TransitionChoice([0, 1, 2, 3]),
      )
      np.testing.assert_equal(instru2.dimension, 6)
      data = instru2.spawn_child(
          new_value=((4, 3), dict(a=0, b=3))
      ).get_standardized_data(reference=instru2)
      np.testing.assert_array_almost_equal(
          data, [4, -1.1503, 0, 0, 0, 0.5878], decimal=4
      )
      child = instru.spawn_child()
      with p.helpers.deterministic_sampling(child):
          args, kwargs = child.set_standardized_data(data).value
      assert (args, kwargs) == ((4.0, 3), {"a": 0, "b": 3})
      assert (
          "3),Dict(a=TransitionChoice(choices=Tuple(0,1,2,3),"
          in repr(instru)
      ), (f"Erroneous representation {instru}")
      # check deterministic
      data = np.array([0.0, 0, 0, 0, 0, 0])
      total = 0
      for _ in range(24):
          child = instru.spawn_child()
          with p.helpers.deterministic_sampling(child):
              total += child.set_standardized_data(data).kwargs["b"]
      np.testing.assert_equal(total, 0)
      # check stochastic
      for _ in range(24):
          total += (
              instru.spawn_child()
              .set_standardized_data(data)
              .kwargs["b"]
          )
      assert total != 0
      # check duplicate
      # instru2 = mvar.Instrumentation(*instru.args, **instru.kwargs)  # TODO: OUCH SILENT FAIL
      instru2.copy()
      data = np.random.normal(0, 1, size=6)
      values: tp.List[tp.Any] = []
      for val_instru in [instru, instru2]:
          child = val_instru.spawn_child()
          with p.helpers.deterministic_sampling(child):
              values.append(child.set_standardized_data(data).value)
      assert values[0] == values[1]
      # check naming
      instru_str = (
          "Instrumentation(Tuple(Scalar[sigma=Scalar{exp=2.03}],3),"
          "Dict(a=TransitionChoice(choices=Tuple(0,1,2,3),"
          "indices=Array{Cd(0,4),Add,Int},transitions=[1. 1.]),"
          "b=Choice(choices=Tuple(0,1,2,3),indices=Array{(1,4),SoftmaxSampling})))"
      )
      assert instru.name == instru_str
      assert instru.set_name("blublu").name == "blublu"
  
file_path: nevergrad/nevergrad/parametrization/test_parameters_legacy.py
imports: import typing
  import numpy
  import pytest
  from .None import parameter
label_desc: Use image node_id 2 for calling a global function with example usage: test_instrumentation() without return types