code: def test_load_checkpoint_strict_loading(tmp_path):
      """Test that an error is raised if a key is requested to be restored but does not exist in the checkpoint."""
      strategy = (
          SingleDeviceStrategy()
      )  # surrogate class to test implementation in base class
      saved_state = {"a": 1, "b": 2}
      requested_state = {
          "a": 1,
          "b": 2,
          "c": 3,
      }  # key `c` does not exist in the saved state
      load_checkpoint_mock = Mock(return_value=saved_state)
      strategy.checkpoint_io.load_checkpoint = load_checkpoint_mock
      with pytest.raises(
          KeyError, match="contains a key 'c' that does not exist"
      ):
          strategy.load_checkpoint(
              tmp_path, requested_state, strict=True
          )
  
imports: from unittest import mock
  from unittest.mock import Mock, PropertyMock
  import pytest
  import torch
  from lightning.fabric.plugins import DoublePrecision, HalfPrecision, Precision
  from lightning.fabric.strategies import SingleDeviceStrategy
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.fabric.utilities.types import _Stateful
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 9 for calling a global function with example usage: test_load_checkpoint_strict_loading(tmp_path) without return types