code: def test_out_of_the_range_categorical() -> None:
      def objective(trial: Trial) -> float:
          x = trial.suggest_int("x", -1, 1)
          y = trial.suggest_categorical("y", [-1, 0, 1])
          return x**2 + y**2
  
      fixed_y = 2
  
      # It isn't possible to fix categorical parameters as out-of-the-range value.
      # `ValueError` will occur.
      study = optuna.create_study()
      with warnings.catch_warnings():
          warnings.simplefilter(
              "ignore", optuna.exceptions.ExperimentalWarning
          )
          study.sampler = PartialFixedSampler(
              fixed_params={"y": fixed_y}, base_sampler=study.sampler
          )
      with pytest.raises(ValueError):
          study.optimize(objective, n_trials=1)
  
file_path: optuna/tests/samplers_tests/test_partial_fixed.py
imports: from unittest.mock import patch
  import warnings
  import pytest
  import optuna
  from optuna.samplers import PartialFixedSampler
  from optuna.samplers import RandomSampler
  from optuna.trial import Trial
label_desc: Use image node_id 4 for calling a global function with example usage: test_out_of_the_range_categorical() and returns: unknown