code: def _test_checkpointer_with_val_losses(
      self, checkpointer, val_losses, has_checkpoints
  ):
      generator = some_data_generator(ModelCheckpointTest.batch_size)
  
      checkpointer.set_params({"epochs": len(val_losses), "steps": 1})
      checkpointer.set_model(self.model)
      checkpointer.on_train_begin({})
      for epoch, (val_loss, has_checkpoint) in enumerate(
          zip(val_losses, has_checkpoints), 1
      ):
          checkpointer.on_epoch_begin(epoch, {})
          checkpointer.on_train_batch_begin(1, {})
          loss = self._update_model(generator)
          checkpointer.on_train_batch_end(
              1,
              {
                  "batch": 1,
                  "size": ModelCheckpointTest.batch_size,
                  "loss": loss,
              },
          )
          checkpointer.on_epoch_end(
              epoch,
              {"epoch": epoch, "loss": loss, "val_loss": val_loss},
          )
          filename = self.checkpoint_filename.format(epoch=epoch)
          self.assertEqual(has_checkpoint, os.path.isfile(filename))
      checkpointer.on_train_end({})
  
imports: import os
  import unittest
  from tempfile import TemporaryDirectory
  from unittest import TestCase
  import torch
  import torch.nn
  from poutyne import Model, ModelCheckpoint, torch_to_numpy
  from tests.framework.tools import some_data_generator
label_desc: Use image node_id 13 for calling the ModelCheckpointTest obj's underlying member method code with example usage: obj._test_checkpointer_with_val_losses(checkpointer, val_losses, has_checkpoints) without return types