code: def test_normalize_categorical():
      categories = ["cat", "dog", "rat"]
      a = Categorical(categories, transform="normalize")
      for i in range(len(categories)):
          assert a.rvs(random_state=i)[0] in categories
      assert a.inverse_transform([0.0]) == [categories[0]]
      assert a.inverse_transform([0.5]) == [categories[1]]
      assert a.inverse_transform([1.0]) == [categories[2]]
      assert_array_equal(categories, a.inverse_transform([0.0, 0.5, 1]))
  
      categories = [1, 2, 3]
      a = Categorical(categories, transform="normalize")
      assert_array_equal(
          categories, np.sort(np.unique(a.rvs(100, random_state=1)))
      )
      assert_array_equal(
          categories, a.inverse_transform([0.0, 0.5, 1.0])
      )
  
      categories = [1.0, 2.0, 3.0]
      a = Categorical(categories, transform="normalize")
      assert_array_equal(
          categories, np.sort(np.unique(a.rvs(100, random_state=1)))
      )
      assert_array_equal(
          categories, a.inverse_transform([0.0, 0.5, 1.0])
      )
  
      categories = [1, 2, 3]
      a = Categorical(categories, transform="string")
      a.set_transformer("normalize")
      assert_array_equal(
          categories, np.sort(np.unique(a.rvs(100, random_state=1)))
      )
      assert_array_equal(
          categories, a.inverse_transform([0.0, 0.5, 1.0])
      )
  
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 21 for calling a global function with example usage: test_normalize_categorical() without return types