code: def test_to_file(self):
      if sys.version_info[0] >= 3:
          callback = PyCM()
          callback.to_pycm_file("test {epoch}")
          cm = MagicMock()
          callback._handlers[0](cm, {torchbearer.EPOCH: 1})
  
          cm.save_stat.assert_called_once_with("test 1")
  
          callback = PyCM()
          callback.to_html_file("test {epoch}")
          cm = MagicMock()
          callback._handlers[0](cm, {torchbearer.EPOCH: 2})
  
          cm.save_html.assert_called_once_with("test 2")
  
          callback = PyCM()
          callback.to_csv_file("test {epoch}")
          cm = MagicMock()
          callback._handlers[0](cm, {torchbearer.EPOCH: 3})
  
          cm.save_csv.assert_called_once_with("test 3")
  
          callback = PyCM()
          callback.to_obj_file("test {epoch}")
          cm = MagicMock()
          callback._handlers[0](cm, {torchbearer.EPOCH: 4})
  
          cm.save_obj.assert_called_once_with("test 4")
  
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 9 for calling the TestPyCM obj's underlying member method code with example usage: obj.test_to_file() without return types