code: def test_run_in_graph_and_eager_modes(self):
      l = []
  
      def inc(self, with_brackets):
          del self  # self argument is required by run_in_graph_and_eager_modes.
          mode = "eager" if tf.executing_eagerly() else "graph"
          with_brackets = (
              "with_brackets" if with_brackets else "without_brackets"
          )
          l.append((with_brackets, mode))
  
      f = test_utils.run_in_graph_and_eager_modes(inc)
      f(self, with_brackets=False)
      f = test_utils.run_in_graph_and_eager_modes()(inc)
      f(self, with_brackets=True)
  
      self.assertEqual(len(l), 4)
      self.assertEqual(
          set(l),
          {
              ("with_brackets", "graph"),
              ("with_brackets", "eager"),
              ("without_brackets", "graph"),
              ("without_brackets", "eager"),
          },
      )
  
file_path: datasets/tensorflow_datasets/testing/test_utils_test.py
imports: import pathlib
  import pytest
  import tensorflow
  from tensorflow_datasets.testing import test_case
  from tensorflow_datasets.testing import test_utils
label_desc: Use image node_id 1 for calling the RunInGraphAndEagerTest obj's underlying member method code with example usage: obj.test_run_in_graph_and_eager_modes() without return types