code: def test_attributes_upon_fitting(_strategy, _bins, estimator):
      transformer = clone(estimator)
      transformer.set_params(bins=_bins, strategy=_strategy)
  
      X, y = test_df(categorical=True)
  
      if transformer.__class__.__name__ == "TargetMeanRegressor":
          # y needs to be continuous
          y = X["var_10"]
  
      transformer.fit(X, y)
  
      assert transformer.bins == _bins
      assert transformer.strategy == _strategy
  
      if _strategy == "equal_width":
          assert (
              type(transformer._pipeline.named_steps["discretiser"])
              == EqualWidthDiscretiser
          )
      else:
          assert (
              type(transformer._pipeline.named_steps["discretiser"])
              == EqualFrequencyDiscretiser
          )
  
      assert (
          type(transformer._pipeline.named_steps["encoder_num"])
          == MeanEncoder
      )
  
      assert (
          type(transformer._pipeline.named_steps["encoder_cat"])
          == MeanEncoder
      )
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.base import clone
  from sklearn.exceptions import NotFittedError
  from sklearn.utils.estimator_checks import check_estimator
  from feature_engine._prediction.base_predictor import BaseTargetMeanEstimator
  from feature_engine._prediction.target_mean_classifier import TargetMeanClassifier
  from feature_engine._prediction.target_mean_regressor import TargetMeanRegressor
  from feature_engine.discretisation import EqualFrequencyDiscretiser, EqualWidthDiscretiser
  from feature_engine.encoding import MeanEncoder
  from tests.estimator_checks.dataframe_for_checks import test_df
  from tests.estimator_checks.fit_functionality_checks import check_error_if_y_not_passed
label_desc: Use image node_id 8 for calling a global function with example usage: test_attributes_upon_fitting(_strategy, _bins, estimator) without return types