code: def test_accept_trial(self):
      # _accept_trial(self, energy_trial, feasible_trial, cv_trial,
      #               energy_orig, feasible_orig, cv_orig)
      def constr_f(x):
          return [x[0] + x[1]]
  
      nlc = NonlinearConstraint(constr_f, -np.inf, 1.9)
      solver = DifferentialEvolutionSolver(
          rosen, [(0, 2), (0, 2)], constraints=(nlc)
      )
      fn = solver._accept_trial
      # both solutions are feasible, select lower energy
      assert fn(0.1, True, np.array([0.0]), 1.0, True, np.array([0.0]))
      assert (
          fn(1.0, True, np.array([0.0]), 0.1, True, np.array([0.0]))
          == False
      )
      assert fn(0.1, True, np.array([0.0]), 0.1, True, np.array([0.0]))
  
      # trial is feasible, original is not
      assert fn(9.9, True, np.array([0.0]), 1.0, False, np.array([1.0]))
  
      # trial and original are infeasible
      # cv_trial have to be <= cv_original to be better
      assert fn(
          0.1,
          False,
          np.array([0.5, 0.5]),
          1.0,
          False,
          np.array([1.0, 1.0]),
      )
      assert fn(
          0.1,
          False,
          np.array([0.5, 0.5]),
          1.0,
          False,
          np.array([1.0, 0.50]),
      )
      assert (
          fn(
              1.0,
              False,
              np.array([0.5, 0.5]),
              1.0,
              False,
              np.array([1.0, 0.4]),
          )
          == False
      )
  
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 44 for calling the TestDifferentialEvolutionSolver obj's underlying member method code with example usage: obj.test_accept_trial() and returns: list