code: def test_add_metric_fail(self, _, __, writer):
      mock_fn = MagicMock()
  
      def fn_test(ex, types):
          def fn_test_1(tag, metric, *args, **kwargs):
              if type(metric) in types:
                  raise ex
              else:
                  mock_fn(tag, metric)
  
          return fn_test_1
  
      tb = TensorBoard()
      state = {torchbearer.METRICS: {"test": 0.1}}
      with warnings.catch_warnings(record=True) as w:
          tb.add_metric(
              fn_test(Exception, [float]),
              "single",
              state[torchbearer.METRICS]["test"],
          )
          self.assertTrue(len(w) == 1)
  
      call_args = list(mock_fn.call_args_list)
      call_args.sort()
      self.assertTrue(len(call_args) == 0)
  
imports: import os
  from unittest import TestCase
  import warnings
  import torch
  import torch.nn
  from mock import patch, Mock, ANY, MagicMock
  import torchbearer
  from torchbearer.callbacks import TensorBoard, TensorBoardImages, TensorBoardProjector, TensorBoardText
label_desc: Use image node_id 7 for calling the TestTensorBoard obj's underlying member method code with example usage: obj.test_add_metric_fail(_, __, writer) and returns: fn_test_1