code: def test_mock_tf(self):
      # pylint: disable=g-import-not-at-top,reimported
      import tensorflow as tf_lib1
      import tensorflow as tf_lib2
  
      # pylint: enable=g-import-not-at-top,reimported
  
      def f():
          pass
  
      original_exists = tf_lib1.io.gfile.exists
      original_list_dir = tf_lib1.io.gfile.listdir
  
      self.assertIs(tf_lib1.io.gfile.exists, original_exists)
      self.assertIs(tf_lib2.io.gfile.listdir, original_list_dir)
  
      with test_utils.mock_tf("tf.io.gfile", exists=f):
          # Both aliases should have been patched
          self.assertIs(tf_lib1.io.gfile.exists, f)
          self.assertIs(tf_lib2.io.gfile.exists, f)
          self.assertIs(tf_lib1.io.gfile.listdir, original_list_dir)
          self.assertIs(tf_lib2.io.gfile.listdir, original_list_dir)
  
      self.assertIsNot(tf_lib1.io.gfile.exists, f)
      self.assertIsNot(tf_lib2.io.gfile.exists, f)
      self.assertIs(tf_lib1.io.gfile.exists, original_exists)
      self.assertIs(tf_lib1.io.gfile.listdir, original_list_dir)
      self.assertIs(tf_lib2.io.gfile.exists, original_exists)
      self.assertIs(tf_lib2.io.gfile.listdir, original_list_dir)
  
      with test_utils.mock_tf("tf.io.gfile.exists", f):
          self.assertIs(tf_lib1.io.gfile.exists, f)
          self.assertIs(tf_lib2.io.gfile.exists, f)
          self.assertIs(tf_lib1.io.gfile.listdir, original_list_dir)
          self.assertIs(tf_lib2.io.gfile.listdir, original_list_dir)
  
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 3 for calling the RunInGraphAndEagerTest obj's underlying member method code with example usage: obj.test_mock_tf() without return types