code: def test_to_minimize(direction: StudyDirection) -> None:
      values = [1, 0, 0, 2, 1]
      trials_before = [create_trial(value=v) for v in values]
  
      expected_values = values[:]
      if direction == StudyDirection.MAXIMIZE:
          expected_values = [-1 * v for v in expected_values]
  
      p = _preprocessing.ToMinimize()
      trials_after = p.apply(trials_before, direction)
      assert _get_trial_values(trials_after) == expected_values
  
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 6 for calling a global function with example usage: test_to_minimize(direction) without return types