code: def test_upgrade_checkpoint_map_location(_, __, load_mock, tmp_path):
      file = tmp_path / "checkpoint.ckpt"
      file.touch()
      with mock.patch("sys.argv", ["upgrade_checkpoint.py", str(file)]):
          upgrade_main()
      assert load_mock.call_args[1]["map_location"] is None
      load_mock.reset_mock()
      with mock.patch(
          "sys.argv",
          ["upgrade_checkpoint.py", str(file), "--map-to-cpu"],
      ):
          upgrade_main()
      assert load_mock.call_args[1]["map_location"] == torch.device(
          "cpu"
      )
  
file_path: pytorch-lightning/tests/tests_pytorch/utilities/test_upgrade_checkpoint.py
imports: import logging
  from pathlib import Path
  from unittest import mock
  from unittest.mock import ANY
  import pytest
  import torch
  from lightning.pytorch.utilities.upgrade_checkpoint import main
label_desc: Use image node_id 4 for calling a global function with example usage: test_upgrade_checkpoint_map_location(_, __, load_mock, tmp_path) without return types