code: def test_targets_to_key(self):
      callback = imaging.ClassAppearanceModel(
          nclasses=10, input_size=(1, 1, 1), target=5
      )
      callback = callback.target_to_key("test")
      state = {torchbearer.DEVICE: "cpu"}
      targets_hot = callback._targets_hot(state)
      self.assertTrue(targets_hot.sum() == 1)
      self.assertTrue(targets_hot[0][5] == 1)
      self.assertTrue(state["test"] == 5)
  
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 2 for calling the TestClassAppearanceModel obj's underlying member method code with example usage: obj.test_targets_to_key() without return types