code: def test_fit_function(dataset, model_name):
      # This test ensures that our estimators return self after a call to fit
      if model_name in [
          "SparseRandomProjection",
          "TSNE",
          "TruncatedSVD",
          "AutoARIMA",
          "MultinomialNB",
          "LabelEncoder",
      ]:
          pytest.xfail("These models are not tested yet")
  
      n_pos_args_constr = func_positional_arg(
          models[model_name].__init__
      )
  
      if model_name in [
          "SparseRandomProjection",
          "GaussianRandomProjection",
      ]:
          model = models[model_name](n_components=2)
      elif model_name in ["ARIMA", "AutoARIMA", "ExponentialSmoothing"]:
          model = models[model_name](np.random.normal(0.0, 1.0, (10,)))
      elif model_name in [
          "RandomForestClassifier",
          "RandomForestRegressor",
      ]:
          model = models[model_name](n_bins=32)
      else:
          if n_pos_args_constr == 1:
              model = models[model_name]()
          elif n_pos_args_constr == 2:
              model = models[model_name](5)
          else:
              model = models[model_name](5, 5)
  
      if hasattr(model, "fit"):
          # Unfortunately co_argcount doesn't work with decorated functions,
          # and the inspect module doesn't work with Cython. Therefore we need
          # to register the number of arguments manually if `fit` is decorated
          pos_args_spec = {
              "ARIMA": 1,
              "ElasticNet": 3,
              "Lasso": 3,
              "LinearRegression": 3,
              "LogisticRegression": 3,
              "NearestNeighbors": 2,
              "PCA": 2,
              "Ridge": 3,
              "UMAP": 2,
          }
          n_pos_args_fit = (
              pos_args_spec[model_name]
              if model_name in pos_args_spec
              else func_positional_arg(models[model_name].fit)
          )
  
          X, y = dataset
  
          if model_name == "RandomForestClassifier":
              y = y.astype(np.int32)
              assert model.fit(X, y) is model
          else:
              if n_pos_args_fit == 1:
                  assert model.fit() is model
              elif n_pos_args_fit == 2:
                  assert model.fit(X) is model
              else:
                  assert model.fit(X, y) is model
  
          # test classifiers correctly set self.classes_ during fit
          if hasattr(model, "_estimator_type"):
              if model._estimator_type == "classifier":
                  cp.testing.assert_array_almost_equal(
                      model.classes_, np.unique(y)
                  )
  
imports: from sklearn.datasets import make_classification
  from cuml.testing.utils import ClassEnumerator
  from cuml.internals.base import Base
  from cuml.internals.safe_imports import cpu_only_import
  import inspect
  import pytest
  import cuml
  import cuml.internals.mixins
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 8 for calling a global function with example usage: test_fit_function(dataset, model_name) without return types