code: def _test_early_stopping(
      self, earlystopper, dummy_metric_values, early_stop_epoch
  ):
      dummy_metric = EarlyStoppingDummyMetric(dummy_metric_values)
      dummy_metric_callback = DummyMetricCallback(dummy_metric)
  
      train_gen = some_data_generator(EarlyStoppingTest.batch_size)
      valid_gen = some_data_generator(EarlyStoppingTest.batch_size)
  
      model = Model(
          self.pytorch_network,
          self.optimizer,
          self.loss_function,
          epoch_metrics=[dummy_metric],
      )
      history = model.fit_generator(
          train_gen,
          valid_gen,
          epochs=10,
          steps_per_epoch=5,
          callbacks=[dummy_metric_callback, earlystopper],
      )
      self.assertEqual(len(history), early_stop_epoch)
      self.assertEqual(history[-1]["epoch"], early_stop_epoch)
  
imports: import unittest
  import torch
  import torch.nn
  from poutyne import Callback, EarlyStopping, Metric, Model
  from tests.framework.base import CaptureOutputBase
  from tests.framework.tools import some_data_generator
label_desc: Use image node_id 8 for calling the EarlyStoppingTest obj's underlying member method code with example usage: obj._test_early_stopping(earlystopper, dummy_metric_values, early_stop_epoch) without return types