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 content list API for PackageExporter's contained modules.
docstr_tok: ["Test","content","list","API","for","PackageExporter","'s","contained","modules","."]
code: def test_exporter_content_lists(self):
      """
      Test content list API for PackageExporter's contained modules.
      """
  
      with PackageExporter(BytesIO()) as he:
          import package_b
  
          he.extern("package_b.subpackage_1")
          he.mock("package_b.subpackage_2")
          he.intern("**")
          he.save_pickle(
              "obj", "obj.pkl", package_b.PackageBObject(["a"])
          )
          self.assertEqual(
              he.externed_modules(), ["package_b.subpackage_1"]
          )
          self.assertEqual(
              he.mocked_modules(), ["package_b.subpackage_2"]
          )
          self.assertEqual(
              he.interned_modules(),
              ["package_b", "package_b.subpackage_0.subsubpackage_0"],
          )
          self.assertEqual(
              he.get_rdeps("package_b.subpackage_2"), ["package_b"]
          )
  
      with self.assertRaises(PackagingError) as e:
          with PackageExporter(BytesIO()) as he:
              import package_b
  
              he.deny("package_b")
              he.save_pickle(
                  "obj", "obj.pkl", package_b.PackageBObject(["a"])
              )
              self.assertEqual(he.denied_modules(), ["package_b"])
  
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 6 for calling the TestMisc obj's underlying member method code with example usage: obj.test_exporter_content_lists() without return types