code: def test_one_to_hot(direction: StudyDirection) -> None:
      # Scenario: categorical parameters are mapped to the float distribution.
      trials_before = [
          create_trial(
              params={"categorical": 0},
              distributions={
                  "categorical": CategoricalDistribution((0, 1))
              },
              value=1.0,
          ),
          create_trial(
              params={"categorical": 1},
              distributions={
                  "categorical": CategoricalDistribution((0, 1))
              },
              value=1.0,
          ),
      ]
      p = _preprocessing.OneToHot()
      trials_after = p.apply(trials_before, direction)
  
      for t in trials_after:
          # Distributions are expected to be mapped to `FloatDistribution(0, 1)` for each choice.
          assert t.distributions == {
              "i0_categorical": FloatDistribution(0, 1),
              "i1_categorical": FloatDistribution(0, 1),
          }
  
      assert len(trials_after) == 2
      assert trials_after[0].params == {
          "i0_categorical": 1.0,
          "i1_categorical": 0.0,
      }
      assert trials_after[1].params == {
          "i0_categorical": 0.0,
          "i1_categorical": 1.0,
      }
  
      # Scenario: int and float parameters are identical even after the preprocessing.
      trials_before = [
          create_trial(
              params={
                  "float": 1,
                  "int": 3,
              },
              distributions={
                  "float": FloatDistribution(1, 10),
                  "int": IntDistribution(1, 10),
              },
              value=1.0,
          ),
      ]
      p = _preprocessing.OneToHot()
      trials_after = p.apply(trials_before, direction)
  
      assert len(trials_after) == 1
      # Note that the param/distribution names are modified with "i0_" prefix to be consistent
      # with categorical parameters.
      assert trials_after[0].params == {
          "i0_float": 1,
          "i0_int": 3,
      }
      assert trials_after[0].distributions == {
          "i0_float": FloatDistribution(1, 10),
          "i0_int": IntDistribution(1, 10),
      }
  
file_path: optuna/tests/terminator_tests/improvement_tests/test_preprocessing.py
imports: from __future__ import annotations
  from unittest import mock
  import numpy
  import pytest
  from optuna.distributions import CategoricalDistribution
  from optuna.distributions import FloatDistribution
  from optuna.distributions import IntDistribution
  from optuna.study._study_direction import StudyDirection
  from optuna.terminator.improvement import _preprocessing
  from optuna.trial import create_trial
  from optuna.trial import FrozenTrial
label_desc: Use image node_id 7 for calling a global function with example usage: test_one_to_hot(direction) without return types