code: def assert_new_op_prefixes(
      test, expected_prefix, assert_some_new_ops=True
  ):
      """Asserts the namescope of tf ops created within the context manager."""
      ops_before = [
          n.name for n in tf.get_default_graph().as_graph_def().node
      ]
      yield
      ops_after = [
          n.name for n in tf.get_default_graph().as_graph_def().node
      ]
      new_ops = set(ops_after) - set(ops_before)
      prefix_length = len(expected_prefix)
      if assert_some_new_ops:
          test.assertNotEqual(0, len(new_ops))
      for op_name in new_ops:
          test.assertEqual(expected_prefix, op_name[:prefix_length])
  
file_path: graph_nets/graph_nets/tests_tf2/test_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import itertools
  from graph_nets import graphs
  from graph_nets import utils_np
  import numpy
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: assert_new_op_prefixes(test, expected_prefix, assert_some_new_ops) without return types