code: def test_max_iter_with_warm_start_validation(GradientBoosting, X, y):
      # Check that a ValueError is raised when the maximum number of iterations
      # is smaller than the number of iterations from the previous fit when warm
      # start is True.
  
      estimator = GradientBoosting(
          max_iter=10, early_stopping=False, warm_start=True
      )
      estimator.fit(X, y)
      estimator.set_params(max_iter=5)
      err_msg = "max_iter=5 must be larger than or equal to n_iter_=10 when warm_start==True"
      with pytest.raises(ValueError, match=err_msg):
          estimator.fit(X, y)
  
file_path: scikit-learn/sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from sklearn.base import clone
  from sklearn.datasets import make_classification, make_regression
  from sklearn.ensemble import HistGradientBoostingClassifier, HistGradientBoostingRegressor
  from sklearn.metrics import check_scoring
label_desc: Use image node_id 2 for calling a global function with example usage: test_max_iter_with_warm_start_validation(GradientBoosting, X, y) without return types