code: def test_trainer_save_checkpoint_storage_options(
      tmpdir, xla_available
  ):
      """This test validates that storage_options argument is properly passed to ``CheckpointIO``"""
      model = BoringModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          fast_dev_run=True,
          enable_checkpointing=False,
      )
      trainer.fit(model)
      instance_path = tmpdir + "/path.ckpt"
      instance_storage_options = "my instance storage options"
  
      with mock.patch(
          "lightning.fabric.plugins.io.torch_io.TorchCheckpointIO.save_checkpoint"
      ) as io_mock:
          trainer.save_checkpoint(
              instance_path, storage_options=instance_storage_options
          )
          io_mock.assert_called_with(
              ANY,
              instance_path,
              storage_options=instance_storage_options,
          )
          trainer.save_checkpoint(instance_path)
          io_mock.assert_called_with(
              ANY, instance_path, storage_options=None
          )
  
      checkpoint_mock = Mock()
      with mock.patch.object(
          trainer.strategy, "save_checkpoint"
      ) as save_mock, mock.patch.object(
          trainer._checkpoint_connector,
          "dump_checkpoint",
          return_value=checkpoint_mock,
      ) as dump_mock:
          trainer.save_checkpoint(instance_path, True)
          dump_mock.assert_called_with(True)
          save_mock.assert_called_with(
              checkpoint_mock, instance_path, storage_options=None
          )
          trainer.save_checkpoint(
              instance_path, False, instance_storage_options
          )
          dump_mock.assert_called_with(False)
          save_mock.assert_called_with(
              checkpoint_mock,
              instance_path,
              storage_options=instance_storage_options,
          )
  
      torch_checkpoint_io = TorchCheckpointIO()
      with pytest.raises(
          TypeError,
          match=r"`Trainer.save_checkpoint\(..., storage_options=...\)` with `storage_options` arg"
          f" is not supported for `{torch_checkpoint_io.__class__.__name__}`. Please implement your custom `CheckpointIO`"
          " to define how you'd like to use `storage_options`.",
      ):
          torch_checkpoint_io.save_checkpoint(
              {},
              instance_path,
              storage_options=instance_storage_options,
          )
      xla_checkpoint_io = XLACheckpointIO()
      with pytest.raises(
          TypeError,
          match=r"`Trainer.save_checkpoint\(..., storage_options=...\)` with `storage_options` arg"
          f" is not supported for `{xla_checkpoint_io.__class__.__name__}`. Please implement your custom `CheckpointIO`"
          " to define how you'd like to use `storage_options`.",
      ):
          xla_checkpoint_io.save_checkpoint(
              {},
              instance_path,
              storage_options=instance_storage_options,
          )
  
file_path: pytorch-lightning/tests/tests_pytorch/checkpointing/test_trainer_checkpoint.py
imports: import os
  from unittest import mock
  from unittest.mock import ANY, Mock
  import lightning.pytorch
  import pytest
  import torch
  from lightning.fabric.plugins import TorchCheckpointIO, XLACheckpointIO
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
label_desc: Use image node_id 2 for calling a global function with example usage: test_trainer_save_checkpoint_storage_options(tmpdir, xla_available) without return types