code: def test_best_metric(self):
      self.run_path = os.path.join(DIR, "checkpt")
      if not os.path.exists(self.run_path):
          os.makedirs(self.run_path)
  
      model_checkpoint = ModelCheckpoint(
          self.run_path,
          self.model_name,
          "test",
          run_config=self.config,
          resume=False,
      )
      model = MockModel()
      optimal_state = model.state.item()
      metric_func = {"acc": max}
      mock_metrics = {
          "current_metrics": {"acc": 12},
          "stage": "test",
          "epoch": 10,
      }
      model_checkpoint.save_best_models_under_current_metrics(
          model, mock_metrics, metric_func
      )
      with torch.no_grad():
          model.state[0] = 2
          mock_metrics = {
              "current_metrics": {"acc": 0},
              "stage": "test",
              "epoch": 11,
          }
          model_checkpoint.save_best_models_under_current_metrics(
              model, mock_metrics, metric_func
          )
          mock_metrics = {
              "current_metrics": {"acc": 10},
              "stage": "train",
              "epoch": 11,
          }
          model_checkpoint.save_best_models_under_current_metrics(
              model, mock_metrics, metric_func
          )
          mock_metrics = {
              "current_metrics": {"acc": 15},
              "stage": "train",
              "epoch": 11,
          }
          model_checkpoint.save_best_models_under_current_metrics(
              model, mock_metrics, metric_func
          )
          self.assertEqual(
              model_checkpoint.checkpoint_path,
              os.path.join(self.run_path, self.model_name + ".pt"),
          )
  
          ckp = torch.load(model_checkpoint.checkpoint_path)
  
          self.assertEqual(
              ckp["models"]["best_acc"]["state"].item(), optimal_state
          )
          self.assertEqual(
              ckp["models"]["latest"]["state"].item(),
              model.state.item(),
          )
  
imports: import unittest
  import omegaconf
  from omegaconf import OmegaConf, DictConfig
  import os
  import sys
  import hydra
  import shutil
  import torch
  from mockdatasets import MockDatasetGeometric
  from torch_points3d.models.model_factory import instantiate_model
  from torch_points3d.utils.model_building_utils.model_definition_resolver import resolve_model
  from torch_points3d.metrics.model_checkpoint import ModelCheckpoint
label_desc: Use image node_id 3 for calling the TestModelCheckpoint obj's underlying member method code with example usage: obj.test_best_metric() without return types