code: def test_hpc_max_ckpt_version(tmpdir):
      """Test that the _CheckpointConnector is able to find the hpc checkpoint file with the highest version."""
      model = BoringModel()
      trainer = Trainer(default_root_dir=tmpdir, max_steps=1)
      trainer.fit(model)
      trainer.save_checkpoint(tmpdir / "hpc_ckpt.ckpt")
      trainer.save_checkpoint(tmpdir / "hpc_ckpt_0.ckpt")
      trainer.save_checkpoint(tmpdir / "hpc_ckpt_3.ckpt")
      trainer.save_checkpoint(tmpdir / "hpc_ckpt_33.ckpt")
  
      assert trainer._checkpoint_connector._hpc_resume_path == str(
          tmpdir / "hpc_ckpt_33.ckpt"
      )
      assert (
          trainer._checkpoint_connector._CheckpointConnector__max_ckpt_version_in_folder(
              tmpdir
          )
          == 33
      )
      assert (
          trainer._checkpoint_connector._CheckpointConnector__max_ckpt_version_in_folder(
              tmpdir / "not" / "existing"
          )
          is None
      )
  
file_path: pytorch-lightning/tests/tests_pytorch/trainer/connectors/test_checkpoint_connector.py
imports: import os
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning.pytorch.utilities.migration.utils import _set_version
label_desc: Use image node_id 3 for calling a global function with example usage: test_hpc_max_ckpt_version(tmpdir) without return types