code: def test_collect_rng_states_if_cuda_init_fails(
      get_rng_state_all_mock,
  ):
      """Test that the `torch.cuda` rng states are only requested if CUDA is available."""
      get_rng_state_all_mock.side_effect = RuntimeError(
          "The NVIDIA driver on your system is too old"
      )
      states = _collect_rng_states()
      assert states["torch.cuda"] == []
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_seed.py
imports: import os
  from unittest import mock
  from unittest.mock import Mock
  import lightning.fabric.utilities
  import pytest
  import torch
  from lightning.fabric.utilities.seed import _collect_rng_states, _set_rng_states
label_desc: Use image node_id 9 for calling a global function with example usage: test_collect_rng_states_if_cuda_init_fails(get_rng_state_all_mock) without return types