code: def test_dimension_name():
      notnames = [1, 1.0, True]
      for n in notnames:
          with pytest.raises(ValueError) as exc:
              real = Real(1, 2, name=n)
              assert (
                  "Dimension's name must be either string or"
                  "None." == exc.value.args[0]
              )
      s = Space(
          [
              Real(1, 2, name="a"),
              Integer(1, 100, name="b"),
              Categorical(["red, blue"], name="c"),
          ]
      )
      assert s["a"] == (0, s.dimensions[0])
      assert s["a", "c"] == [(0, s.dimensions[0]), (2, s.dimensions[2])]
      assert s[["a", "c"]] == [
          (0, s.dimensions[0]),
          (2, s.dimensions[2]),
      ]
      assert s[("a", "c")] == [
          (0, s.dimensions[0]),
          (2, s.dimensions[2]),
      ]
      assert s[0] == (0, s.dimensions[0])
      assert s[0, "c"] == [(0, s.dimensions[0]), (2, s.dimensions[2])]
      assert s[0, 2] == [(0, s.dimensions[0]), (2, s.dimensions[2])]
  
imports: import pytest
  import numbers
  import numpy
  import os
  import yaml
  from tempfile import NamedTemporaryFile
  from numpy.testing import assert_array_almost_equal
  from numpy.testing import assert_array_equal
  from numpy.testing import assert_equal
  from numpy.testing import assert_raises_regex
  from skopt import Optimizer
  from skopt.space import Space
  from skopt.space import Real
  from skopt.space import Integer
  from skopt.space import Categorical
  from skopt.space import check_dimension
  from skopt.utils import normalize_dimensions
label_desc: Use image node_id 35 for calling a global function with example usage: test_dimension_name() without return types