code: def test_get_optimization_history_info_list_with_infeasible(
      direction: str,
  ) -> None:
      target_name = "Target Name"
  
      def objective(trial: Trial) -> float:
          if trial.number == 0:
              trial.set_user_attr("constraint", [0])
              return 1.0
          elif trial.number == 1:
              trial.set_user_attr("constraint", [0])
              return 2.0
          elif trial.number == 2:
              trial.set_user_attr("constraint", [1])
              return 3.0
          return 0.0
  
      def constraints_func(trial: FrozenTrial) -> Sequence[float]:
          return trial.user_attrs["constraint"]
  
      sampler = samplers.TPESampler(constraints_func=constraints_func)
      study = create_study(sampler=sampler, direction=direction)
      study.optimize(objective, n_trials=3)
      info_list = _get_optimization_history_info_list(
          study, target=None, target_name=target_name, error_bar=False
      )
  
      best_values = (
          [1.0, 1.0, 1.0]
          if direction == "minimize"
          else [1.0, 2.0, 2.0]
      )
      states = [
          _ValueState.Feasible,
          _ValueState.Feasible,
          _ValueState.Infeasible,
      ]
      assert info_list == [
          _OptimizationHistoryInfo(
              [0, 1, 2],
              _ValuesInfo(
                  [1.0, 2.0, 3.0],
                  None,
                  target_name,
                  states,
              ),
              _ValuesInfo(best_values, None, "Best Value", states),
          )
      ]
  
imports: from __future__ import annotations
  from io import BytesIO
  import math
  from typing import Sequence
  import numpy
  import pytest
  from optuna import samplers
  from optuna import TrialPruned
  from optuna.study import create_study
  from optuna.testing.objectives import fail_objective
  from optuna.testing.objectives import pruned_objective
  from optuna.trial import FrozenTrial
  from optuna.trial import Trial
  from optuna.visualization._optimization_history import _get_optimization_history_info_list
  from optuna.visualization._optimization_history import _get_optimization_history_plot
  from optuna.visualization._optimization_history import _OptimizationHistoryInfo
  from optuna.visualization._optimization_history import _ValuesInfo
  from optuna.visualization._optimization_history import _ValueState
label_desc: Use image node_id 8 for calling a global function with example usage: test_get_optimization_history_info_list_with_infeasible(direction) and returns: int, trial, int, int, int