code: def test_no_attributes_set_in_init(estimator, preprocessor):
      """Check setting during init. Adapted from scikit-learn."""
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      if hasattr(type(estimator).__init__, "deprecated_original"):
          return
  
      init_params = _get_args(type(estimator).__init__)
      parents_init_params = [
          param
          for params_parent in (
              _get_args(parent) for parent in type(estimator).__mro__
          )
          for param in params_parent
      ]
  
      # Test for no setting apart from parameters during init
      invalid_attr = (
          set(vars(estimator))
          - set(init_params)
          - set(parents_init_params)
      )
      assert not invalid_attr, (
          "Estimator %s should not set any attribute apart"
          " from parameters during init. Found attributes %s."
          % (type(estimator).__name__, sorted(invalid_attr))
      )
      # Ensure that each parameter is set in init
      invalid_attr = (
          set(init_params) - set(vars(estimator)) - set(["self"])
      )
      assert not invalid_attr, (
          "Estimator %s should store all parameters"
          " as an attribute during init. Did not find "
          "attributes %s."
          % (type(estimator).__name__, sorted(invalid_attr))
      )
  
imports: import pytest
  import unittest
  from sklearn.utils.estimator_checks import check_estimator
  from sklearn.base import TransformerMixin
  from sklearn.pipeline import make_pipeline
  from sklearn.utils import check_random_state
  from metric_learn.sklearn_shims import assert_allclose_dense_sparse, set_random_state, _get_args, is_public_parameter, get_scorer
  from metric_learn import Covariance, LFDA, LMNN, MLKR, NCA, ITML_Supervised, LSML_Supervised, MMC_Supervised, RCA_Supervised, SDML_Supervised, SCML_Supervised
  from sklearn import clone
  import numpy
  from sklearn.model_selection import cross_val_score, cross_val_predict, train_test_split, KFold
  from test.test_utils import metric_learners, ids_metric_learners, mock_preprocessor, tuples_learners, ids_tuples_learners, pairs_learners, ids_pairs_learners, remove_y, metric_learners_pipeline, ids_metric_learners_pipeline
label_desc: Use image node_id 10 for calling a global function with example usage: test_no_attributes_set_in_init(estimator, preprocessor) without return types