code: def test_last_checkpoint_saved(self, tmp_path):
      max_steps = 64
      tmp_path = tmp_path / "test_1"
  
      class TestModel(ExampleModel):
          def train_dataloader(self):
              dataset = OnesDataset(64)
              return torch.utils.data.DataLoader(dataset, batch_size=1)
  
      trainer = pl.Trainer(
          accelerator="cpu",
          enable_checkpointing=False,
          logger=False,
          max_steps=max_steps,
          val_check_interval=0.33,
      )
      exp_manager(
          trainer,
          {
              "explicit_log_dir": str(tmp_path),
              "checkpoint_callback_params": {
                  "filename": f"{{val_loss:.4f}}-{{epoch}}-{{step}}"
              },
          },
      )
      model = TestModel()
      trainer.fit(model)
  
      checkpoint_dir = Path(str(tmp_path / "checkpoints"))
      model_path = (
          checkpoint_dir / "val_loss=0.0300-epoch=1-step=64-last.ckpt"
      )
      last_saved_checkpoint = torch.load(model_path)
      assert max_steps == last_saved_checkpoint["global_step"]
  
      # restart training, ensure global step starts correctly
      class AssertCallback(Callback):
          def on_train_start(
              self,
              trainer: "pl.Trainer",
              pl_module: "pl.LightningModule",
          ) -> None:
              assert trainer.global_step == max_steps
  
          def on_train_batch_end(
              self,
              trainer: "pl.Trainer",
              pl_module: "pl.LightningModule",
              outputs,
              batch: Any,
              batch_idx: int,
          ) -> None:
              # we should only be running for one more step.
              assert trainer.global_step == max_steps + 1
  
      trainer = pl.Trainer(
          accelerator="cpu",
          enable_checkpointing=False,
          logger=False,
          max_steps=65,
          val_check_interval=0.33,
          callbacks=AssertCallback(),
      )
      exp_manager(
          trainer,
          {
              "explicit_log_dir": str(tmp_path),
              "checkpoint_callback_params": {
                  "filename": f"{{val_loss:.4f}}-{{epoch}}-{{step}}"
              },
          },
      )
      model = TestModel()
      trainer.fit(model, ckpt_path=model_path)
  
imports: import math
  import os
  import re
  from pathlib import Path
  from typing import Any
  import pytest
  import pytorch_lightning
  import torch
  from omegaconf import OmegaConf
  from omegaconf.errors import OmegaConfBaseException
  from pytorch_lightning import Callback
  from pytorch_lightning.loops import _TrainingEpochLoop
  from nemo.constants import NEMO_ENV_VARNAME_VERSION
  from nemo.core.classes import ModelPT
  from nemo.utils.exp_manager import CheckpointMisconfigurationError, LoggerMisconfigurationError, NotFoundError, exp_manager
label_desc: Use image node_id 12 for calling the TestExpManager obj's underlying member method code with example usage: obj.test_last_checkpoint_saved(tmp_path) and returns: torch