class_docstr: Core save_* and loading API tests.
class_docstr_tok: ["Core","save_","*","and","loading","API","tests","."]
docstr: Exercise a corner case: re-packaging a module that uses `torch_package_importer`
docstr_tok: ["Exercise","a","corner","case",":","re-packaging","a","module","that","uses","`","torch_package_importer","`"]
code: def test_save_imported_module_using_package_importer(self):
      """Exercise a corner case: re-packaging a module that uses `torch_package_importer`"""
      import package_a.use_torch_package_importer  # noqa: F401
  
      buffer = BytesIO()
      with PackageExporter(buffer) as exporter:
          exporter.intern("**")
          exporter.save_module("package_a.use_torch_package_importer")
  
      buffer.seek(0)
  
      importer = PackageImporter(buffer)
  
      # Should export without error.
      buffer2 = BytesIO()
      with PackageExporter(
          buffer2, importer=(importer, sys_importer)
      ) as exporter:
          exporter.intern("**")
          exporter.save_module("package_a.use_torch_package_importer")
  
file_path: pytorch/test/package/test_save_load.py
imports: import pickle
  from io import BytesIO
  from textwrap import dedent
  from torch.package import PackageExporter, PackageImporter, sys_importer
  from torch.testing._internal.common_utils import run_tests
  from pathlib import Path
label_desc: Use image node_id 11 for calling the TestSaveLoad obj's underlying member method code with example usage: obj.test_save_imported_module_using_package_importer() without return types