code: def testRaisesOnNotExpectedFile(self):
      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.normpath(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="",
      )
  
      with self.assertRaisesRegex(
          AssertionError, "Exported api attempted to write to"
      ):
          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,
              "",
              [],
          )
  
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 10 for calling the GeneratorTest obj's underlying member method code with example usage: obj.testRaisesOnNotExpectedFile() without return types