code: def test_fit_docstring_attributes(name, Estimator):
      pytest.importorskip("numpydoc")
      from numpydoc import docscrape
  
      if Estimator.__name__ in _DOCSTRING_IGNORES:
          return
  
      doc = docscrape.ClassDoc(Estimator)
      attributes = doc["Attributes"]
  
      if Estimator.__name__ == "Pipeline":
          est = _construct_compose_pipeline_instance(Estimator)
      else:
          est = _construct_instance(Estimator)
      _set_checking_parameters(est)
  
      X, y = make_classification(
          n_samples=20,
          n_features=3,
          n_redundant=0,
          n_classes=2,
          random_state=2,
      )
  
      y = _enforce_estimator_tags_y(est, y)
      X = _enforce_estimator_tags_x(est, X)
  
      if "oob_score" in est.get_params():
          est.set_params(bootstrap=True, oob_score=True)
  
      if is_sampler(est):
          est.fit_resample(X, y)
      else:
          est.fit(X, y)
  
      skipped_attributes = set([])
  
      for attr in attributes:
          if attr.name in skipped_attributes:
              continue
          desc = " ".join(attr.desc).lower()
          # As certain attributes are present "only" if a certain parameter is
          # provided, this checks if the word "only" is present in the attribute
          # description, and if not the attribute is required to be present.
          if "only " in desc:
              continue
          # ignore deprecation warnings
          with ignore_warnings(category=FutureWarning):
              assert hasattr(est, attr.name)
  
      fit_attr = _get_all_fitted_attributes(est)
      fit_attr_names = [attr.name for attr in attributes]
      undocumented_attrs = set(fit_attr).difference(fit_attr_names)
      undocumented_attrs = set(undocumented_attrs).difference(
          skipped_attributes
      )
      if undocumented_attrs:
          raise AssertionError(
              f"Undocumented attributes for {Estimator.__name__}: {undocumented_attrs}"
          )
  
imports: import importlib
  import inspect
  import warnings
  from inspect import signature
  from pkgutil import walk_packages
  import pytest
  from sklearn.datasets import make_classification
  from sklearn.linear_model import LogisticRegression
  from sklearn.utils import IS_PYPY
  from sklearn.utils._testing import _get_func_name, check_docstring_parameters, ignore_warnings
  from sklearn.utils.estimator_checks import _enforce_estimator_tags_y
  from sklearn.utils.deprecation import _is_deprecated
  from sklearn.utils.estimator_checks import _construct_instance
  import imblearn
  from imblearn.base import is_sampler
  from imblearn.utils.estimator_checks import _set_checking_parameters
  from imblearn.utils.testing import all_estimators
label_desc: Use image node_id 4 for calling a global function with example usage: test_fit_docstring_attributes(name, Estimator) without return types