class_docstr: Core save_* and loading API tests.
class_docstr_tok: ["Core","save_","*","and","loading","API","tests","."]
docstr: Test to ensure bad __imports__ don't cause PackageExporter to fail.
docstr_tok: ["Test","to","ensure","bad","__imports__","do","n't","cause","PackageExporter","to","fail","."]
code: def test_bad_dunder_imports(self):
      """Test to ensure bad __imports__ don't cause PackageExporter to fail."""
      buffer = BytesIO()
      with PackageExporter(buffer) as e:
          e.save_source_string(
              "m",
              '__import__(these, unresolvable, "things", wont, crash, me)',
          )
  
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 5 for calling the TestSaveLoad obj's underlying member method code with example usage: obj.test_bad_dunder_imports() without return types