code: def test_run_trial_exception(storage_mode: str) -> None:
      with StorageSupplier(storage_mode) as storage:
          study = create_study(storage=storage)
          with pytest.raises(ValueError):
              _optimize._run_trial(study, fail_objective, ())
  
      # Test trial with unacceptable exception.
      with StorageSupplier(storage_mode) as storage:
          study = create_study(storage=storage)
          with pytest.raises(ValueError):
              _optimize._run_trial(
                  study, fail_objective, (ArithmeticError,)
              )
  
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 6 for calling a global function with example usage: test_run_trial_exception(storage_mode) without return types