code: def test_one_liner(solver):
      from mystic.math.measures import mean, spread
  
      @with_spread(5.0)
      @with_mean(5.0)
      def constraints(x):
          return x
  
      def cost(x):
          return abs(sum(x) - 5.0)
  
      from numpy import array
  
      x = array([1, 2, 3, 4, 5])
      y = solver(cost, x, constraints=constraints, disp=False)
  
      assert almostEqual(mean(y), 5.0, tol=1e-15)
      assert almostEqual(spread(y), 5.0, tol=1e-15)
      assert almostEqual(cost(y), 4 * (5.0), tol=1e-6)
  
file_path: mystic/mystic/tests/test_solver_constraints.py
imports: from mystic.constraints import *
  from mystic.solvers import *
  from mystic.math import almostEqual
  from mystic.tools import random_seed
label_desc: Use image node_id 1 for calling a global function with example usage: test_one_liner(solver) and returns: x, abs