code: def test_ill_add(self):
      collector = OutputsCollector(n_devices=2)
      foo = tf.zeros([2, 2])
      bar = tf.zeros([42])
      with self.assertRaisesRegexp(AssertionError, ""):
          collector.add_to_collection(name=None, var=None)
      with self.assertRaisesRegexp(AssertionError, ""):
          collector.add_to_collection(name=None, var=bar)
      with self.assertRaisesRegexp(ValueError, ""):
          collector.add_to_collection(
              name=foo, var=bar, average_over_devices=True
          )
          collector.add_to_collection(
              name=foo, var=bar, average_over_devices=True
          )
          collector.add_to_collection(
              name=foo, var=bar, average_over_devices=True
          )
  
file_path: NiftyNet/tests/output_collector_test.py
imports: from __future__ import absolute_import, print_function
  import tensorflow
  from niftynet.engine.application_variables import NETWORK_OUTPUT, CONSOLE, TF_SUMMARIES
  from niftynet.engine.application_variables import OutputsCollector
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 7 for calling the OutputCollectorTest obj's underlying member method code with example usage: obj.test_ill_add() without return types