code: def test_gen_init_files(self, root_file_name):
      output_dir = self.create_tempdir()
      mapping_dir = self.create_tempdir()
      write_test_data(mapping_dir.full_path)
  
      file_prefixes_to_strip = [mapping_dir.full_path]
  
      public_api = generator.get_public_api(
          [os.path.join(mapping_dir, f) for f in test_data],
          file_prefixes_to_strip=file_prefixes_to_strip,
          packages_to_ignore=["tf.python.framework.test_ops"],
          output_package="tf",
          module_prefix="",
      )
  
      paths_expected = [
          root_file_name if root_file_name else "__init__.py",
          "experimental/__init__.py",
          "experimental/numpy/__init__.py",
      ]
      paths_expected = set(
          [
              os.path.normpath(os.path.join(output_dir, path))
              for path in paths_expected
          ]
      )
      if root_file_name is None:
          generator._gen_init_files(
              output_dir,
              "tf",
              2,
              public_api.v2_entrypoints_by_module,
              public_api.v2_generated_imports_by_module,
              public_api.docs_by_module,
              "",
              file_prefixes_to_strip,
              False,
              "",
              paths_expected,
          )
      else:
          generator._gen_init_files(
              output_dir,
              "tf",
              2,
              public_api.v2_entrypoints_by_module,
              public_api.v2_generated_imports_by_module,
              public_api.docs_by_module,
              "",
              file_prefixes_to_strip,
              False,
              "",
              paths_expected,
              root_file_name=root_file_name,
          )
      expected_init_path = os.path.join(
          output_dir.full_path,
          root_file_name if root_file_name else "__init__.py",
      )
      self.assertTrue(os.path.exists(expected_init_path))
      with open(expected_init_path, "r") as f:
          self.assertEqual(
              f.read(),
              """# This file is MACHINE GENERATED! Do not edit.
  # Generated by: tensorflow/python/tools/api/generator2/generator/generator.py script.
  \"""Public API for tf namespace
  \"""
  
  import sys as _sys
  
  from tf import experimental
  from tf.python.framework.tensor import Tensor # line: 1
  """,
          )
      expected_numpy_path = os.path.join(
          output_dir.full_path, "experimental/numpy/__init__.py"
      )
      self.assertTrue(os.path.exists(expected_numpy_path))
      with open(expected_numpy_path, "r") as f:
          self.assertEqual(
              f.read(),
              """# This file is MACHINE GENERATED! Do not edit.
  # Generated by: tensorflow/python/tools/api/generator2/generator/generator.py script.
  \"""Public API for tf.experimental.numpy namespace
  \"""
  
  import sys as _sys
  
  from tf.python.framework.tensor import Tensor as ndarray # line: 1
  """,
          )
  
file_path: tensorflow/tensorflow/python/tools/api/generator2/generator/generator_test.py
imports: import collections
  import os
  from absl.testing import absltest
  from absl.testing import parameterized
  from tensorflow.python.tools.api.generator2.generator import generator
  from tensorflow.python.tools.api.generator2.shared import exported_api
label_desc: Use image node_id 9 for calling the GeneratorTest obj's underlying member method code with example usage: obj.test_gen_init_files(root_file_name) without return types