code: def test_load_legacy_checkpoints(tmpdir, pl_version: str):
      PATH_LEGACY = os.path.join(LEGACY_CHECKPOINTS_PATH, pl_version)
      with patch("sys.path", [PATH_LEGACY] + sys.path):
          path_ckpts = sorted(
              glob.glob(
                  os.path.join(PATH_LEGACY, f"*{CHECKPOINT_EXTENSION}")
              )
          )
          assert (
              path_ckpts
          ), f'No checkpoints found in folder "{PATH_LEGACY}"'
          path_ckpt = path_ckpts[-1]
  
          model = ClassificationModel.load_from_checkpoint(
              path_ckpt, num_features=24
          )
          trainer = Trainer(default_root_dir=str(tmpdir))
          dm = ClassifDataModule(
              num_features=24,
              length=6000,
              batch_size=128,
              n_clusters_per_class=2,
              n_informative=8,
          )
          res = trainer.test(model, datamodule=dm)
          assert res[0]["test_loss"] <= 0.85, str(res[0]["test_loss"])
          assert res[0]["test_acc"] >= 0.7, str(res[0]["test_acc"])
          print(res)
  
imports: import glob
  import os
  import sys
  from unittest.mock import patch
  import lightning.pytorch
  import pytest
  import torch
  from lightning.pytorch import Callback, Trainer
  from tests_pytorch import _PATH_LEGACY
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
  from tests_pytorch.helpers.threading import ThreadExceptionHandler
label_desc: Use image node_id 1 for calling a global function with example usage: test_load_legacy_checkpoints(tmpdir, pl_version) without return types