code: def test_save_checkpoint_rank_zero_only(is_rank_zero, tmp_path):
      """Test that the checkpoint only gets saved on global rank 0 in the base implementation in Strategy."""
      strategy = (
          SingleDeviceStrategy()
      )  # surrogate class to test implementation in base class
      save_checkpoint_mock = Mock()
      strategy.checkpoint_io.save_checkpoint = save_checkpoint_mock
      with mock.patch(
          "lightning.fabric.strategies.single_device.SingleDeviceStrategy.is_global_zero",
          new_callable=PropertyMock(return_value=is_rank_zero),
      ):
          strategy.save_checkpoint(tmp_path, {"anything": 1})
      assert save_checkpoint_mock.call_count == int(is_rank_zero)
  
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 1 for calling a global function with example usage: test_save_checkpoint_rank_zero_only(is_rank_zero, tmp_path) without return types