code: def test_read_trials_from_remote_storage() -> None:
      base_storage = RDBStorage("sqlite:///:memory:")
      storage = _CachedStorage(base_storage)
      study_id = storage.create_new_study(
          directions=[StudyDirection.MINIMIZE], study_name="test-study"
      )
  
      storage._read_trials_from_remote_storage(study_id)
  
      # Non-existent study.
      with pytest.raises(KeyError):
          storage._read_trials_from_remote_storage(study_id + 1)
  
      # Create a trial via CachedStorage and update it via backend storage directly.
      trial_id = storage.create_new_trial(study_id)
      base_storage.set_trial_param(
          trial_id,
          "paramA",
          1.2,
          optuna.distributions.FloatDistribution(-0.2, 2.3),
      )
      base_storage.set_trial_state_values(
          trial_id, TrialState.COMPLETE, values=[0.0]
      )
      storage._read_trials_from_remote_storage(study_id)
      assert storage.get_trial(trial_id).state == TrialState.COMPLETE
  
file_path: optuna/tests/storages_tests/test_cached_storage.py
imports: from unittest.mock import patch
  import pytest
  import optuna
  from optuna.storages._cached_storage import _CachedStorage
  from optuna.storages._rdb.storage import RDBStorage
  from optuna.study import StudyDirection
  from optuna.trial import TrialState
label_desc: Use image node_id 4 for calling a global function with example usage: test_read_trials_from_remote_storage() without return types