code: def test_misc_doccer_deprecation():
      # gh-18279, gh-17572, gh-17771 noted that deprecation warnings
      # for imports from private modules were misleading.
      # Check that this is resolved.
      # `test_private_but_present_deprecation` cannot be used since `correct_import`
      # is a different subpackage (`_lib` instead of `misc`).
      module = import_module("scipy.misc.doccer")
      correct_import = import_module("scipy._lib.doccer")
  
      # Attributes that were formerly in `scipy.misc.doccer` can still be imported from
      # `scipy.misc.doccer`, albeit with a deprecation warning. The specific message
      # depends on whether the attribute is in `scipy._lib.doccer` or not.
      for attr_name in module.__all__:
          attr = getattr(correct_import, attr_name, None)
          if attr is None:
              message = f"`scipy.misc.{attr_name}` is deprecated..."
          else:
              message = f"Please import `{attr_name}` from the `scipy._lib.doccer`..."
          with pytest.deprecated_call(match=message):
              getattr(module, attr_name)
  
      # Attributes that were not in `scipy.misc.doccer` get an error
      # notifying the user that the attribute is not in `scipy.misc.doccer`
      # and that `scipy.misc.doccer` is deprecated.
      message = "`scipy.misc.doccer` is deprecated..."
      with pytest.raises(AttributeError, match=message):
          getattr(module, "ekki")
  
file_path: scipy/scipy/_lib/tests/test_public_api.py
imports: import pkgutil
  import types
  import importlib
  import warnings
  from importlib import import_module
  import pytest
  import scipy
  from scipy.conftest import xp_available_backends
label_desc: Use image node_id 7 for calling a global function with example usage: test_misc_doccer_deprecation() without return types