code: def test_getattr(module_name):
      """
      Test that __getattr__ methods raise AttributeError for unknown keys.
      See #20822, #20855.
      """
      try:
          module = import_module(module_name)
      except (ImportError, RuntimeError) as e:
          # Skip modules that cannot be imported due to missing dependencies
          pytest.skip(f"Cannot import {module_name} due to {e}")
  
      key = "THIS_SYMBOL_SHOULD_NOT_EXIST"
      if hasattr(module, key):
          delattr(module, key)
  
imports: from importlib import import_module
  from pkgutil import walk_packages
  import matplotlib
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_getattr(module_name) without return types