code: def test_get_optimization_history_info_list_with_error_bar(
      direction: str,
  ) -> None:
      n_studies = 10
      target_name = "Target Name"
  
      def objective(trial: Trial) -> float:
          if trial.number == 0:
              return 1.0
          elif trial.number == 1:
              return 2.0
          elif trial.number == 2:
              return 0.0
          return 0.0
  
      # Test with trials.
      studies = [
          create_study(direction=direction) for _ in range(n_studies)
      ]
      for study in studies:
          study.optimize(objective, n_trials=3)
      info_list = _get_optimization_history_info_list(
          study, target=None, target_name=target_name, error_bar=True
      )
  
      best_values = (
          [1.0, 1.0, 0.0]
          if direction == "minimize"
          else [1.0, 2.0, 2.0]
      )
      assert info_list == [
          _OptimizationHistoryInfo(
              [0, 1, 2],
              _ValuesInfo(
                  [1.0, 2.0, 0.0],
                  [0.0, 0.0, 0.0],
                  target_name,
                  [_ValueState.Feasible] * 3,
              ),
              _ValuesInfo(
                  best_values,
                  [0.0, 0.0, 0.0],
                  "Best Value",
                  [_ValueState.Feasible] * 3,
              ),
          )
      ]
  
      # Test customized target.
      info_list = _get_optimization_history_info_list(
          study,
          target=lambda t: t.number,
          target_name=target_name,
          error_bar=True,
      )
      assert info_list == [
          _OptimizationHistoryInfo(
              [0, 1, 2],
              _ValuesInfo(
                  [0.0, 1.0, 2.0],
                  [0.0, 0.0, 0.0],
                  target_name,
                  [_ValueState.Feasible] * 3,
              ),
              None,
          )
      ]
  
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 10 for calling a global function with example usage: test_get_optimization_history_info_list_with_error_bar(direction) and returns: int, int, int, int