code: def test_clean_up_of_cached_result_if_database_fails(
      tmp_path: Path,
      monkeypatch: MonkeyPatch,
      default_model_storage: ModelStorage,
      local_cache_creator: Callable[..., LocalTrainingCache],
  ):
      database_name = "test.db"
      monkeypatch.setenv(CACHE_DB_NAME_ENV, database_name)
  
      cache = local_cache_creator(tmp_path)
  
      # Deleting the database will cause an error when caching the result
      (tmp_path / database_name).unlink()
  
      # Cache an item
      fingerprint_key = uuid.uuid4().hex
      output = TestCacheableOutput(
          {"something to cache": "dasdaasda"}, size_in_mb=2
      )
      output_fingerprint = uuid.uuid4().hex
  
      with pytest.raises(OperationalError):
          cache.cache_output(
              fingerprint_key,
              output,
              output_fingerprint,
              default_model_storage,
          )
  
      assert list(tmp_path.glob("*")) == [tmp_path / database_name]
  
imports: import dataclasses
  import logging
  import shutil
  import uuid
  from pathlib import Path
  from typing import Dict, Text, Optional, Any, Callable
  from unittest.mock import Mock
  import pytest
  from _pytest.logging import LogCaptureFixture
  from _pytest.monkeypatch import MonkeyPatch
  from sqlalchemy.exc import OperationalError
  import rasa.shared.utils.io
  import rasa.shared.utils.common
  from rasa.engine.caching import LocalTrainingCache, CACHE_LOCATION_ENV, DEFAULT_CACHE_NAME, CACHE_SIZE_ENV, CACHE_DB_NAME_ENV, TrainingCache
  import tests.conftest
  from rasa.engine.storage.local_model_storage import LocalModelStorage
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
label_desc: Use image node_id 14 for calling a global function with example usage: test_clean_up_of_cached_result_if_database_fails(tmp_path, monkeypatch, default_model_storage, local_cache_creator) without return types