code: def test_brute_lmfit_vs_scipy_default(params_lmfit):
      """TEST 1: using finite bounds with Ns=20, keep=50 and brute_step=None."""
      assert params_lmfit["x"].brute_step is None
      assert params_lmfit["y"].brute_step is None
  
      rranges = ((-4, 4), (-2, 2))
      ret = optimize.brute(
          func_scipy,
          rranges,
          args=params,
          full_output=True,
          Ns=20,
          finish=None,
      )
      mini = lmfit.Minimizer(func_lmfit, params_lmfit)
      out = mini.minimize(method="brute", Ns=20)
  
      assert out.method == "brute"
      assert_equal(
          out.nfev, 20 ** len(out.var_names)
      )  # Ns * nmb varying params
      assert_equal(
          len(out.candidates), 50
      )  # top-50 candidates are stored
  
      assert_equal(ret[2], out.brute_grid)  # grid identical
      assert_equal(
          ret[3], out.brute_Jout
      )  # function values on grid identical
  
      # best-fit values identical / stored correctly in MinimizerResult
      assert_equal(ret[0][0], out.brute_x0[0])
      assert_equal(ret[0][0], out.params["x"].value)
  
      assert_equal(ret[0][1], out.brute_x0[1])
      assert_equal(ret[0][1], out.params["y"].value)
  
      assert_equal(ret[1], out.brute_fval)
      assert_equal(ret[1], out.residual)
  
imports: import pickle
  import numpy
  from numpy.testing import assert_allclose, assert_equal
  import pytest
  from scipy import optimize
  import lmfit
label_desc: Use image node_id 4 for calling a global function with example usage: test_brute_lmfit_vs_scipy_default(params_lmfit) without return types