code: def test_dict_unchanged(estimator, build_dataset, with_preprocessor):
      # Adapted from scikit-learn
      (input_data, labels, preprocessor, to_transform) = build_dataset(
          with_preprocessor
      )
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      if hasattr(estimator, "n_components"):
          estimator.n_components = 1
      estimator.fit(*remove_y(estimator, input_data, labels))
  
      def check_dict():
          assert estimator.__dict__ == dict_before, (
              "Estimator changes __dict__ during %s" % method
          )
  
      for method in ["predict", "decision_function", "predict_proba"]:
          if hasattr(estimator, method):
              dict_before = estimator.__dict__.copy()
              getattr(estimator, method)(input_data)
              check_dict()
      if hasattr(estimator, "transform"):
          dict_before = estimator.__dict__.copy()
          # we transform only dataset of points
          estimator.transform(to_transform)
          check_dict()
  
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 13 for calling a global function with example usage: test_dict_unchanged(estimator, build_dataset, with_preprocessor) without return types