code: def test_split_trials(
      direction: str, constant_liar: bool, constraints: bool
  ) -> None:
      study = optuna.create_study(direction=direction)
  
      for value in [-float("inf"), 0, 1, float("inf")]:
          study.add_trial(
              optuna.create_trial(
                  state=optuna.trial.TrialState.COMPLETE,
                  value=(value if direction == "minimize" else -value),
                  params={"x": 0},
                  distributions={
                      "x": optuna.distributions.FloatDistribution(
                          -1.0, 1.0
                      )
                  },
                  system_attrs={_CONSTRAINTS_KEY: [-1]},
              )
          )
  
      for step in [2, 1]:
          for value in [
              -float("inf"),
              0,
              1,
              float("inf"),
              float("nan"),
          ]:
              study.add_trial(
                  optuna.create_trial(
                      state=optuna.trial.TrialState.PRUNED,
                      params={"x": 0},
                      distributions={
                          "x": optuna.distributions.FloatDistribution(
                              -1.0, 1.0
                          )
                      },
                      system_attrs={_CONSTRAINTS_KEY: [-1]},
                      intermediate_values={
                          step: (
                              value
                              if direction == "minimize"
                              else -value
                          )
                      },
                  )
              )
  
      study.add_trial(
          optuna.create_trial(
              state=optuna.trial.TrialState.PRUNED,
              params={"x": 0},
              distributions={
                  "x": optuna.distributions.FloatDistribution(-1.0, 1.0)
              },
              system_attrs={_CONSTRAINTS_KEY: [-1]},
          )
      )
  
      if constraints:
          for value in [1, 2, float("inf")]:
              study.add_trial(
                  optuna.create_trial(
                      state=optuna.trial.TrialState.COMPLETE,
                      value=0,
                      params={"x": 0},
                      distributions={
                          "x": optuna.distributions.FloatDistribution(
                              -1.0, 1.0
                          )
                      },
                      system_attrs={_CONSTRAINTS_KEY: [value]},
                  )
              )
  
      study.add_trial(
          optuna.create_trial(
              state=optuna.trial.TrialState.RUNNING,
              params={"x": 0},
              distributions={
                  "x": optuna.distributions.FloatDistribution(-1.0, 1.0)
              },
              system_attrs={_CONSTRAINTS_KEY: [-1]},
          )
      )
  
      study.add_trial(
          optuna.create_trial(
              state=optuna.trial.TrialState.FAIL,
          )
      )
  
      study.add_trial(
          optuna.create_trial(
              state=optuna.trial.TrialState.WAITING,
          )
      )
  
      if constant_liar:
          states = [
              optuna.trial.TrialState.COMPLETE,
              optuna.trial.TrialState.PRUNED,
              optuna.trial.TrialState.RUNNING,
          ]
      else:
          states = [
              optuna.trial.TrialState.COMPLETE,
              optuna.trial.TrialState.PRUNED,
          ]
  
      trials = study.get_trials(states=states)
      finished_trials = study.get_trials(
          states=(
              optuna.trial.TrialState.COMPLETE,
              optuna.trial.TrialState.PRUNED,
          )
      )
      for n_below in range(len(finished_trials) + 1):
          below_trials, above_trials = _tpe.sampler._split_trials(
              study,
              trials,
              n_below,
              constraints,
          )
  
          below_trial_numbers = [trial.number for trial in below_trials]
          assert below_trial_numbers == list(range(n_below))
          above_trial_numbers = [trial.number for trial in above_trials]
          assert above_trial_numbers == list(
              range(n_below, len(trials))
          )
  
imports: from __future__ import annotations
  import random
  from typing import Callable
  from typing import Dict
  from typing import Optional
  from typing import Union
  from unittest.mock import Mock
  from unittest.mock import patch
  import warnings
  import _pytest.capture
  import numpy
  import pytest
  import optuna
  from optuna import distributions
  from optuna.samplers import _tpe
  from optuna.samplers import TPESampler
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.trial import Trial
label_desc: Use image node_id 33 for calling a global function with example usage: test_split_trials(direction, constant_liar, constraints) without return types