code: def test_with_mean_spread():
      from mystic.math.measures import (
          mean,
          spread,
          impose_mean,
          impose_spread,
      )
  
      @with_spread(50.0)
      @with_mean(5.0)
      def constrained_squared(x):
          return [i**2 for i in x]
  
      from numpy import array
  
      x = array([1, 2, 3, 4, 5])
      y = impose_spread(50.0, impose_mean(5.0, [i**2 for i in x]))
      assert almostEqual(mean(y), 5.0, tol=1e-15)
      assert almostEqual(spread(y), 50.0, tol=1e-15)
      assert constrained_squared(x) == y
  
file_path: mystic/mystic/tests/test_constraints.py
imports: from mystic.constraints import *
  from mystic.penalty import quadratic_equality
  from mystic.coupler import inner
  from mystic.math import almostEqual
  from mystic.tools import random_seed
label_desc: Use image node_id 8 for calling a global function with example usage: test_with_mean_spread() and returns: unknown