code: def test_confidence_leastsq(data, pars, verbose, capsys):
      """Calculate confidence interval after leastsq minimization."""
      minimizer = lmfit.Minimizer(residual, pars, fcn_args=(data))
      out = minimizer.leastsq()
  
      assert 5 < out.nfev < 500
      assert out.chisqr < 3.0
      assert out.nvarys == 2
      assert_allclose(out.params["a"], 0.1, rtol=0.01)
      assert_allclose(out.params["b"], 2.0, rtol=0.01)
  
      ci = lmfit.conf_interval(minimizer, out, verbose=verbose)
      assert_allclose(ci["b"][0][0], 0.997, rtol=0.01)
      assert_allclose(ci["b"][0][1], 1.947, rtol=0.01)
      assert_allclose(ci["b"][2][0], 0.683, rtol=0.01)
      assert_allclose(ci["b"][2][1], 1.972, rtol=0.01)
      assert_allclose(ci["b"][5][0], 0.95, rtol=0.01)
      assert_allclose(ci["b"][5][1], 2.01, rtol=0.01)
  
      if verbose:
          captured = capsys.readouterr()
          assert "Calculating CI for" in captured.out
  
imports: import copy
  import numpy
  from numpy.testing import assert_allclose
  import pytest
  from scipy.stats import f
  import lmfit
label_desc: Use image node_id 6 for calling a global function with example usage: test_confidence_leastsq(data, pars, verbose, capsys) without return types