code: def test_n_iterations(
      Est, max_resources, n_iterations, n_possible_iterations
  ):
      # test the number of actual iterations that were run depending on
      # max_resources
  
      n_samples = 1024
      X, y = make_classification(n_samples=n_samples, random_state=1)
      param_grid = {"a": [1, 2], "b": list(range(10))}
      base_estimator = FastClassifier()
      factor = 2
  
      sh = Est(
          base_estimator,
          param_grid,
          cv=2,
          factor=factor,
          max_resources=max_resources,
          min_resources=4,
      )
      if Est is HalvingRandomSearchCV:
          sh.set_params(
              n_candidates=20
          )  # same as for HalvingGridSearchCV
      sh.fit(X, y)
      assert sh.n_required_iterations_ == 5
      assert sh.n_iterations_ == n_iterations
      assert sh.n_possible_iterations_ == n_possible_iterations
  
imports: from math import ceil
  import numpy
  import pytest
  from scipy.stats import expon, norm, randint
  from sklearn.datasets import make_classification
  from sklearn.dummy import DummyClassifier
  from sklearn.experimental import enable_halving_search_cv
  from sklearn.model_selection import GroupKFold, GroupShuffleSplit, HalvingGridSearchCV, HalvingRandomSearchCV, KFold, LeaveOneGroupOut, LeavePGroupsOut, ShuffleSplit, StratifiedKFold, StratifiedShuffleSplit
  from sklearn.model_selection._search_successive_halving import _SubsampleMetaSplitter, _top_k
  from sklearn.model_selection.tests.test_search import check_cv_results_array_types, check_cv_results_keys
  from sklearn.svm import SVC, LinearSVC
label_desc: Use image node_id 4 for calling a global function with example usage: test_n_iterations(Est, max_resources, n_iterations, n_possible_iterations) without return types