code: def test_monitor_should_terminate(self):
      state = {
          torchbearer.EPOCH: 0,
          torchbearer.BATCH: 0,
          torchbearer.STOP_TRAINING: False,
          torchbearer.METRICS: {
              "running_loss": 0.001,
              "test_metric": float("nan"),
          },
      }
  
      terminator = TerminateOnNaN(monitor="test_metric")
  
      terminator.on_step_training(state)
      self.assertTrue(state[torchbearer.STOP_TRAINING])
      terminator.on_step_validation(state)
      self.assertTrue(state[torchbearer.STOP_TRAINING])
      terminator.on_end_epoch(state)
      self.assertTrue(state[torchbearer.STOP_TRAINING])
  
file_path: torchbearer/tests/callbacks/test_terminate_on_nan.py
imports: from unittest import TestCase
  import torchbearer
  from torchbearer.callbacks import TerminateOnNaN
label_desc: Use image node_id 3 for calling the TestTerminateOnNaN obj's underlying member method code with example usage: obj.test_monitor_should_terminate() without return types