class_docstr: Dependency management API tests.
  - mock()
  - extern()
  - deny()
class_docstr_tok: ["Dependency","management","API","tests",".","-","mock","(",")","-","extern","(",")","-","deny","(",")"]
code: def test_pickle_mocked(self):
      import package_a.subpackage
  
      obj = package_a.subpackage.PackageASubpackageObject()
      obj2 = package_a.PackageAObject(obj)
  
      buffer = BytesIO()
      with self.assertRaises(PackagingError):
          with PackageExporter(buffer) as he:
              he.mock(include="package_a.subpackage")
              he.intern("**")
              he.save_pickle("obj", "obj.pkl", obj2)
  
imports: import importlib
  from io import BytesIO
  from sys import version_info
  from textwrap import dedent
  from unittest import skipIf
  import torch.nn
  from torch.package import EmptyMatchError, Importer, PackageExporter, PackageImporter
  from torch.package.package_exporter import PackagingError
  from torch.testing._internal.common_utils import IS_WINDOWS, run_tests
label_desc: Use image node_id 9 for calling the TestDependencyAPI obj's underlying member method code with example usage: obj.test_pickle_mocked() without return types