code: def test_itercb_reset_abort(method):
      """Regression test for GH Issue #756.
  
      Make sure that ``self._abort`` is reset to ``False`` at the start of each
      fit.
  
      """
      if method in ("nelder", "differential_evolution"):
          pytest.xfail(
              "scalar_minimizers behave differently, but shouldn't!!"
          )
  
      must_stop = True
  
      def callback(*args, **kwargs):
          return must_stop
  
      # perform minimization with ``iter_cb``
      out_model = mod.fit(y, pars, x=x, method=method, iter_cb=callback)
  
      mini = Minimizer(
          residual, pars, fcn_args=(x, y), iter_cb=callback
      )
      out_minimizer = mini.minimize(method=method)
  
      assert out_model.aborted is must_stop
      assert out_model.errorbars is not must_stop
      assert out_model.success is not must_stop
      assert out_minimizer.aborted is must_stop
      assert out_minimizer.errorbars is not must_stop
      assert out_minimizer.success is not must_stop
      assert mini._abort is must_stop
  
      # perform another minimization now without ``iter_cb``
      must_stop = False
      out_minimizer_no_callback = mini.minimize(method=method)
      assert out_minimizer_no_callback.aborted is must_stop
      assert out_minimizer_no_callback.errorbars is not must_stop
      assert out_minimizer_no_callback.success is not must_stop
      assert mini._abort is must_stop
  
      # reset to mini._abort to False and call the optimization method directly
      func = getattr(mini, method)
      out_no_callback = func()
      assert out_no_callback.aborted is must_stop
      assert out_no_callback.errorbars is not must_stop
      assert out_no_callback.success is not must_stop
      assert mini._abort is must_stop
  
file_path: lmfit-py/tests/test_itercb.py
imports: import numpy
  import pytest
  from lmfit.lineshapes import gaussian
  from lmfit.minimizer import Minimizer
  from lmfit.models import GaussianModel, LinearModel
label_desc: Use image node_id 5 for calling a global function with example usage: test_itercb_reset_abort(method) and returns: must_stop