code: def test_on_batch(self, _, wrapper, loss):
      wrapper().input_image = torch.nn.Parameter(torch.zeros(10))
  
      factory = MagicMock()
      callback = imaging.ClassAppearanceModel(
          nclasses=10, input_size=(1, 1, 1), optimizer_factory=factory
      )
  
      model = MagicMock()
      callback.on_batch(
          {
              torchbearer.EPOCH: 0,
              torchbearer.MODEL: model,
              torchbearer.DEVICE: "cpu",
              torchbearer.DATA_TYPE: torch.float32,
          }
      )
  
      loss.assert_called_once_with(torchbearer.PREDICTION, ANY, 0.01)
  
      self.assertTrue(model.eval.call_count == 1)
      self.assertTrue(model.train.call_count == 1)
      self.assertTrue(factory.call_count == 1)
      self.assertTrue(
          next(iter(factory.call_args[0][0])) is wrapper().input_image
      )
  
file_path: torchbearer/tests/callbacks/imaging/test_inside_cnns.py
imports: from unittest import TestCase
  from mock import MagicMock, patch, ANY
  import torch
  import torchbearer
  import torchbearer.callbacks.imaging
label_desc: Use image node_id 6 for calling the TestClassAppearanceModel obj's underlying member method code with example usage: obj.test_on_batch(_, wrapper, loss) without return types