class_docstr: Tests to verify correct import behavior for file executables.
class_docstr_tok: ["Tests","to","verify","correct","import","behavior","for","file","executables","."]
code: def testFileNameModuleFileFailure(self):
      # Confirm that an invalid file that masks a non-existent module fails.
      with self.assertRaisesRegex(
          ValueError, r"Fire can only be called on \.py files\."
      ):  # pylint: disable=line-too-long,  # pytype: disable=attribute-error
          dirname = os.path.dirname(self.file.name)
          with testutils.ChangeDirectory(dirname):
              with open("foobar", "w"):
                  __main__.main(
                      [
                          "__main__.py",
                          "foobar",
                      ]
                  )
  
              os.remove("foobar")
  
file_path: python-fire/fire/main_test.py
imports: import os
  import tempfile
  from fire import __main__
  from fire import testutils
label_desc: Use image node_id 5 for calling the MainModuleFileTest obj's underlying member method code with example usage: obj.testFileNameModuleFileFailure() without return types