code: def test_to_pyplot(self, mock_pyplot):
      if sys.version_info[0] >= 3:
          import pycm
  
          handler = torchbearer.callbacks.pycm._to_pyplot(
              True, "test {epoch}"
          )
  
          y_true = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
          y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
          cm = pycm.ConfusionMatrix(y_true, y_pred)
          handler(cm, {torchbearer.EPOCH: 3})
  
          self.assertTrue(mock_pyplot.imshow.call_args[0][0].max() == 1)
          mock_pyplot.title.assert_called_once_with("test 3")
  
          handler = torchbearer.callbacks.pycm._to_pyplot(False)
  
          y_true = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
          y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
          cm = pycm.ConfusionMatrix(y_true, y_pred)
          handler(cm, {})
  
          self.assertTrue(mock_pyplot.imshow.call_args[0][0].max() > 1)
  
imports: import sys
  from unittest import TestCase
  from mock import MagicMock, patch, ANY
  import torchbearer
  from torchbearer.callbacks import PyCM
  import matplotlib.pyplot
label_desc: Use image node_id 1 for calling the TestHandlers obj's underlying member method code with example usage: obj.test_to_pyplot(mock_pyplot) without return types