code: def test_file_equivalence_after_rewrite(self):
      wrong_modules = []
      for module in FLAGS.modules_to_check:
          static_file = os.path.join(
              absltest.get_default_test_srcdir(),
              "{}/internal/backend/numpy/gen/{}.py".format(
                  TFP_PYTHON_DIR, module
              ),
          )
          gen_file = os.path.join(
              absltest.get_default_test_srcdir(),
              "{}/internal/backend/numpy/{}_gen.py".format(
                  TFP_PYTHON_DIR, module
              ),
          )
          try:
              with open(static_file, "r") as f:
                  static_content = f.read()
          except IOError:
              static_content = None
          try:
              with open(gen_file, "r") as f:
                  gen_content = f.read()
          except IOError:
              gen_content = None
          if gen_content is None and static_content is None:
              raise ValueError(
                  "Could not load content for {}".format(static_file)
              )
          if gen_content != static_content:
              if FLAGS.update:
                  to_update = static_file.split("runfiles/")[-1]
                  to_update = "/".join(to_update.split("/")[1:])
                  with open(to_update, "w") as f:
                      f.write(gen_content)
                  logging.info("Updating file %s", to_update)
              else:
                  wrong_modules.append(module)
      if wrong_modules:
          msg = "\n".join(
              [
                  "Modules `{}` require updates.  To update them, run".format(
                      repr(wrong_modules)
                  ),
                  "bazel build -c opt :rewrite_equivalence_test",
                  "bazel-py3/bin/.../rewrite_equivalence_test --update "
                  "--modules_to_check={}".format(
                      ",".join(wrong_modules)
                  ),
                  "It may be necessary to adapt the generator programs.",
              ]
          )
          raise AssertionError(msg)
  
imports: import os
  from absl import flags
  from absl import logging
  from absl.testing import absltest
label_desc: Use image node_id 1 for calling the RewriteEquivalenceTest obj's underlying member method code with example usage: obj.test_file_equivalence_after_rewrite() without return types