class_docstr: Ways of Dimensions builder.
class_docstr_tok: ["Ways","of","Dimensions","builder","."]
docstr: Create correctly a `Categorical` dimension.
docstr_tok: ["Create","correctly","a","`","Categorical","`","dimension","."]
code: def test_build_choices(self, dimbuilder):
      """Create correctly a `Categorical` dimension."""
      dim = dimbuilder.build(
          "yolo", "choices('adfa', 1, 0.3, 'asaga', shape=4)"
      )
      assert isinstance(dim, Categorical)
      assert dim.name == "yolo"
      assert dim._prior_name == "Distribution"
      assert isinstance(dim.prior, dists.rv_discrete)
  
      dim = dimbuilder.build("yolo", "choices(['adfa', 1])")
      assert isinstance(dim, Categorical)
      assert dim.name == "yolo"
      assert dim._prior_name == "Distribution"
      assert isinstance(dim.prior, dists.rv_discrete)
  
      dim = dimbuilder.build(
          "yolo2", "choices({'adfa': 0.1, 3: 0.4, 5: 0.5})"
      )
      assert isinstance(dim, Categorical)
      assert dim.name == "yolo2"
      assert dim._prior_name == "Distribution"
      assert isinstance(dim.prior, dists.rv_discrete)
  
      with pytest.raises(TypeError) as exc:
          dimbuilder.build("yolo2", "choices({'adfa': 0.1, 3: 0.4})")
      assert "Parameter" in str(exc.value)
      assert "sum" in str(exc.value.__cause__)
  
imports: import pytest
  from scipy.stats import distributions
  from orion.algo.space import Categorical, Fidelity, Integer, Real
  from orion.core.io.space_builder import DimensionBuilder, SpaceBuilder
label_desc: Use image node_id 14 for calling the TestDimensionBuilder obj's underlying member method code with example usage: obj.test_build_choices(dimbuilder) without return types