code: def test_private_but_present_deprecation(module_name, correct_module):
      # gh-18279, gh-17572, gh-17771 noted that deprecation warnings
      # for imports from private modules
      # were misleading. Check that this is resolved.
      module = import_module(module_name)
      if correct_module is None:
          import_name = f'scipy.{module_name.split(".")[1]}'
      else:
          import_name = (
              f'scipy.{module_name.split(".")[1]}.{correct_module}'
          )
  
      correct_import = import_module(import_name)
  
      # Attributes that were formerly in `module_name` can still be imported from
      # `module_name`, albeit with a deprecation warning. The specific message
      # depends on whether the attribute is public in `scipy.xxx` or not.
      for attr_name in module.__all__:
          attr = getattr(correct_import, attr_name, None)
          if attr is None:
              message = f"`{module_name}.{attr_name}` is deprecated..."
          else:
              message = f"Please import `{attr_name}` from the `{import_name}`..."
          with pytest.deprecated_call(match=message):
              getattr(module, attr_name)
  
      # Attributes that were not in `module_name` get an error notifying the user
      # that the attribute is not in `module_name` and that `module_name` is deprecated.
      message = f"`{module_name}` 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 6 for calling a global function with example usage: test_private_but_present_deprecation(module_name, correct_module) without return types