code: def test_migrate_checkpoint(monkeypatch):
      """Test that the correct migration function gets executed given the current version of the checkpoint."""
      # A checkpoint that is older than any migration point in the index
      old_checkpoint = {
          "pytorch-lightning_version": "0.0.0",
          "content": 123,
      }
      new_checkpoint, call_order = _run_simple_migration(
          monkeypatch, old_checkpoint
      )
      assert call_order == ["one", "two", "three", "four"]
      assert (
          new_checkpoint
          == old_checkpoint
          == {
              "legacy_pytorch-lightning_version": "0.0.0",
              "pytorch-lightning_version": pl.__version__,
              "content": 123,
          }
      )
  
      # A checkpoint that is newer, but not the newest
      old_checkpoint = {
          "pytorch-lightning_version": "1.0.3",
          "content": 123,
      }
      new_checkpoint, call_order = _run_simple_migration(
          monkeypatch, old_checkpoint
      )
      assert call_order == ["four"]
      assert (
          new_checkpoint
          == old_checkpoint
          == {
              "legacy_pytorch-lightning_version": "1.0.3",
              "pytorch-lightning_version": pl.__version__,
              "content": 123,
          }
      )
  
      # A checkpoint newer than any migration point in the index
      old_checkpoint = {
          "pytorch-lightning_version": pl.__version__,
          "content": 123,
      }
      new_checkpoint, call_order = _run_simple_migration(
          monkeypatch, old_checkpoint
      )
      assert call_order == []
      assert (
          new_checkpoint
          == old_checkpoint
          == {
              "pytorch-lightning_version": pl.__version__,
              "content": 123,
          }
      )
  
imports: import glob
  import logging
  import os
  import pickle
  import sys
  from unittest.mock import ANY
  import lightning.pytorch
  import pytest
  import torch
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.utilities.migration import migrate_checkpoint, pl_legacy_patch
  from lightning.pytorch.utilities.migration.utils import _pl_migrate_checkpoint, _RedirectingUnpickler
  from lightning_utilities.core.imports import module_available
  from lightning_utilities.test.warning import no_warning_call
  from packaging.version import Version
  from tests_pytorch.checkpointing.test_legacy_checkpoints import CHECKPOINT_EXTENSION, LEGACY_BACK_COMPATIBLE_PL_VERSIONS, LEGACY_CHECKPOINTS_PATH
label_desc: Use image node_id 8 for calling a global function with example usage: test_migrate_checkpoint(monkeypatch) without return types