code: def test_constraint_wrapper_violation(self):
      def cons_f(x):
          return np.array([x[0] ** 2 + x[1], x[0] ** 2 - x[1]])
  
      nlc = NonlinearConstraint(cons_f, [-1, -0.8500], [2, 2])
      pc = _ConstraintWrapper(nlc, [0.5, 1])
      assert np.size(pc.bounds[0]) == 2
  
      assert_array_equal(pc.violation([0.5, 1]), [0.0, 0.0])
      assert_almost_equal(pc.violation([0.5, 1.2]), [0.0, 0.1])
      assert_almost_equal(pc.violation([1.2, 1.2]), [0.64, 0])
      assert_almost_equal(pc.violation([0.1, -1.2]), [0.19, 0])
      assert_almost_equal(pc.violation([0.1, 2]), [0.01, 1.14])
  
imports: import multiprocessing
  import platform
  from scipy.optimize._differentialevolution import DifferentialEvolutionSolver, _ConstraintWrapper
  from scipy.optimize import differential_evolution
  from scipy.optimize._constraints import Bounds, NonlinearConstraint, LinearConstraint
  from scipy.optimize import rosen
  from scipy.sparse import csr_matrix
  from scipy._lib._pep440 import Version
  import numpy
  from numpy.testing import assert_equal, assert_allclose, assert_almost_equal, assert_array_equal, assert_string_equal, assert_, suppress_warnings
  from pytest import raises, warns
  import pytest
label_desc: Use image node_id 46 for calling the TestDifferentialEvolutionSolver obj's underlying member method code with example usage: obj.test_constraint_wrapper_violation() and returns: np