code: def test_run_in_graph_and_eager_modes_setup_in_same_mode(self):
      modes = []
      mode_name = lambda: "eager" if tf.executing_eagerly() else "graph"
  
      class ExampleTest(tf.test.TestCase):
          def runTest(self):
              pass
  
          def setUp(self):
              modes.append("setup_" + mode_name())
  
          @test_utils.run_in_graph_and_eager_modes
          def testBody(self):
              modes.append("run_" + mode_name())
  
      e = ExampleTest()
      e.setUp()
      e.testBody()
  
      self.assertEqual(modes[0:2], ["setup_eager", "run_eager"])
      self.assertEqual(modes[2:], ["setup_graph", "run_graph"])
  
file_path: tensor2tensor/tensor2tensor/utils/test_utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.utils import test_utils
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the RunInGraphAndEagerTest obj's underlying member method code with example usage: obj.test_run_in_graph_and_eager_modes_setup_in_same_mode() without return types