code: def test_maxfun_stops_solve(self):
      # test that if the maximum number of function evaluations is exceeded
      # during initialisation the solver stops
      solver = DifferentialEvolutionSolver(
          rosen, self.bounds, maxfun=1, polish=False
      )
      result = solver.solve()
  
      assert_equal(result.nfev, 2)
      assert_equal(result.success, False)
      assert_equal(
          result.message,
          "Maximum number of function evaluations has "
          "been exceeded.",
      )
  
      # test that if the maximum number of function evaluations is exceeded
      # during the actual minimisation, then the solver stops.
      # Have to turn polishing off, as this will still occur even if maxfun
      # is reached. For popsize=5 and len(bounds)=2, then there are only 10
      # function evaluations during initialisation.
      solver = DifferentialEvolutionSolver(
          rosen, self.bounds, popsize=5, polish=False, maxfun=40
      )
      result = solver.solve()
  
      assert_equal(result.nfev, 41)
      assert_equal(result.success, False)
      assert_equal(
          result.message,
          "Maximum number of function evaluations has "
          "been exceeded.",
      )
  
      # now repeat for updating='deferred version
      solver = DifferentialEvolutionSolver(
          rosen,
          self.bounds,
          popsize=5,
          polish=False,
          maxfun=40,
          updating="deferred",
      )
      result = solver.solve()
  
      assert_equal(result.nfev, 40)
      assert_equal(result.success, False)
      assert_equal(
          result.message,
          "Maximum number of function evaluations has " "been reached.",
      )
  
imports: import multiprocessing
  from scipy.optimize import _differentialevolution
  from scipy.optimize._differentialevolution import DifferentialEvolutionSolver
  from scipy.optimize import differential_evolution
  import numpy
  from scipy.optimize import rosen
  from numpy.testing import assert_equal, assert_allclose, assert_almost_equal, assert_string_equal, assert_
  from pytest import raises, warns
label_desc: Use image node_id 22 for calling the TestDifferentialEvolutionSolver obj's underlying member method code with example usage: obj.test_maxfun_stops_solve() without return types