class_docstr: Tests for one-off or random functionality. Try not to add to this!
class_docstr_tok: ["Tests","for","one-off","or","random","functionality",".","Try","not","to","add","to","this","!"]
docstr: Test Directory's has_file() method.
docstr_tok: ["Test","Directory","'s","has_file","(",")","method","."]
code: def test_file_structure_has_file(self):
      """
      Test Directory's has_file() method.
      """
      buffer = BytesIO()
      with PackageExporter(buffer) as he:
          import package_a.subpackage
  
          he.intern("**")
          obj = package_a.subpackage.PackageASubpackageObject()
          he.save_pickle("obj", "obj.pkl", obj)
  
      buffer.seek(0)
  
      importer = PackageImporter(buffer)
      file_structure = importer.file_structure()
      self.assertTrue(
          file_structure.has_file("package_a/subpackage.py")
      )
      self.assertFalse(file_structure.has_file("package_a/subpackage"))
  
imports: import inspect
  import os
  import platform
  import sys
  from io import BytesIO
  from pathlib import Path
  from textwrap import dedent
  from unittest import skipIf
  from torch.package import is_from_package, PackageExporter, PackageImporter
  from torch.package.package_exporter import PackagingError
  from torch.testing._internal.common_utils import IS_FBCODE, IS_SANDCASTLE, run_tests, skipIfTorchDynamo
label_desc: Use image node_id 5 for calling the TestMisc obj's underlying member method code with example usage: obj.test_file_structure_has_file() without return types