code: def test_vectorization(self, shape):
      # Test for correct functionality, output shapes, and dtypes for various
      # input shapes.
      loc = (
          np.linspace(-0.05, 1.05, 12).reshape(shape) if shape else 0.6
      )
      args = (loc,)
  
      @np.vectorize
      def chandrupatla_single(loc_single):
          return _chandrupatla_minimize(
              self.f, -5, 0, 5, args=(loc_single,)
          )
  
      def f(*args, **kwargs):
          f.f_evals += 1
          return self.f(*args, **kwargs)
  
      f.f_evals = 0
  
      res = _chandrupatla_minimize(f, -5, 0, 5, args=args)
      refs = chandrupatla_single(loc).ravel()
  
      ref_x = [ref.x for ref in refs]
      assert_allclose(res.x.ravel(), ref_x)
      assert_equal(res.x.shape, shape)
  
      ref_fun = [ref.fun for ref in refs]
      assert_allclose(res.fun.ravel(), ref_fun)
      assert_equal(res.fun.shape, shape)
      assert_equal(res.fun, self.f(res.x, *args))
  
      ref_success = [ref.success for ref in refs]
      assert_equal(res.success.ravel(), ref_success)
      assert_equal(res.success.shape, shape)
      assert np.issubdtype(res.success.dtype, np.bool_)
  
      ref_flag = [ref.status for ref in refs]
      assert_equal(res.status.ravel(), ref_flag)
      assert_equal(res.status.shape, shape)
      assert np.issubdtype(res.status.dtype, np.integer)
  
      ref_nfev = [ref.nfev for ref in refs]
      assert_equal(res.nfev.ravel(), ref_nfev)
      assert_equal(np.max(res.nfev), f.f_evals)
      assert_equal(res.nfev.shape, res.fun.shape)
      assert np.issubdtype(res.nfev.dtype, np.integer)
  
      ref_nit = [ref.nit for ref in refs]
      assert_equal(res.nit.ravel(), ref_nit)
      assert_equal(np.max(res.nit), f.f_evals - 3)
      assert_equal(res.nit.shape, res.fun.shape)
      assert np.issubdtype(res.nit.dtype, np.integer)
  
      ref_xl = [ref.xl for ref in refs]
      assert_allclose(res.xl.ravel(), ref_xl)
      assert_equal(res.xl.shape, shape)
  
      ref_xm = [ref.xm for ref in refs]
      assert_allclose(res.xm.ravel(), ref_xm)
      assert_equal(res.xm.shape, shape)
  
      ref_xr = [ref.xr for ref in refs]
      assert_allclose(res.xr.ravel(), ref_xr)
      assert_equal(res.xr.shape, shape)
  
      ref_fl = [ref.fl for ref in refs]
      assert_allclose(res.fl.ravel(), ref_fl)
      assert_equal(res.fl.shape, shape)
      assert_allclose(res.fl, self.f(res.xl, *args))
  
      ref_fm = [ref.fm for ref in refs]
      assert_allclose(res.fm.ravel(), ref_fm)
      assert_equal(res.fm.shape, shape)
      assert_allclose(res.fm, self.f(res.xm, *args))
  
      ref_fr = [ref.fr for ref in refs]
      assert_allclose(res.fr.ravel(), ref_fr)
      assert_equal(res.fr.shape, shape)
      assert_allclose(res.fr, self.f(res.xr, *args))
  
imports: import pytest
  import numpy
  from numpy.testing import assert_allclose, assert_equal, assert_array_less
  from scipy import stats
  import scipy.optimize._chandrupatla
  from scipy.optimize._chandrupatla import _chandrupatla_minimize
  from itertools import permutations
label_desc: Use image node_id 3 for calling the TestChandrupatlaMinimize obj's underlying member method code with example usage: obj.test_vectorization(shape) and returns: _chandrupatla_minimize, self