class_docstr: Tests for compatibility with TorchScript.
class_docstr_tok: ["Tests","for","compatibility","with","TorchScript","."]
code: def test_package_script_class(self):
      import package_a.fake_script_class as fake
  
      buffer = BytesIO()
      with PackageExporter(buffer) as pe:
          pe.save_module(fake.__name__)
      buffer.seek(0)
  
      package_importer = PackageImporter(buffer)
      loaded = package_importer.import_module(fake.__name__)
  
      input = torch.tensor(1)
      self.assertTrue(
          torch.allclose(
              fake.uses_script_class(input),
              loaded.uses_script_class(input),
          )
      )
  
imports: from io import BytesIO
  from textwrap import dedent
  from unittest import skipIf
  import torch
  from torch.package import PackageExporter, PackageImporter
  from torch.testing._internal.common_utils import IS_FBCODE, IS_SANDCASTLE, run_tests
label_desc: Use image node_id 3 for calling the TestPackageScript obj's underlying member method code with example usage: obj.test_package_script_class() without return types