code: def test_run_trial(
      storage_mode: str, caplog: LogCaptureFixture
  ) -> None:
      with StorageSupplier(storage_mode) as storage:
          study = create_study(storage=storage)
  
          caplog.clear()
          frozen_trial = _optimize._run_trial(
              study, lambda _: 1.0, catch=()
          )
          assert frozen_trial.state == TrialState.COMPLETE
          assert frozen_trial.value == 1.0
          assert (
              "Trial 0 finished with value: 1.0 and parameters"
              in caplog.text
          )
  
          caplog.clear()
          frozen_trial = _optimize._run_trial(
              study, lambda _: float("inf"), catch=()
          )
          assert frozen_trial.state == TrialState.COMPLETE
          assert frozen_trial.value == float("inf")
          assert (
              "Trial 1 finished with value: inf and parameters"
              in caplog.text
          )
  
          caplog.clear()
          frozen_trial = _optimize._run_trial(
              study, lambda _: -float("inf"), catch=()
          )
          assert frozen_trial.state == TrialState.COMPLETE
          assert frozen_trial.value == -float("inf")
          assert (
              "Trial 2 finished with value: -inf and parameters"
              in caplog.text
          )
  
imports: from typing import Callable
  from typing import Generator
  from typing import Optional
  from unittest import mock
  from _pytest.logging import LogCaptureFixture
  import pytest
  from optuna import create_study
  from optuna import logging
  from optuna import Trial
  from optuna import TrialPruned
  from optuna.study import _optimize
  from optuna.study._tell import _tell_with_warning
  from optuna.study._tell import STUDY_TELL_WARNING_KEY
  from optuna.testing.objectives import fail_objective
  from optuna.testing.storages import STORAGE_MODES
  from optuna.testing.storages import StorageSupplier
  from optuna.trial import TrialState
label_desc: Use image node_id 2 for calling a global function with example usage: test_run_trial(storage_mode, caplog) without return types