code: def test_set_behavior():
      from mystic.math import almostEqual
      from numpy import inf
  
      # check basic behavior for set of two points
      s = set(
          [point(1.0, 1.0), point(3.0, 2.0)]
      )  # XXX: s + [pt, pt] => broken
      assert almostEqual(s.mean, 2.33333333)
      assert almostEqual(s.range, 2.0)
      assert almostEqual(s.mass, 3.0)
  
      # basic behavior for an admissable set
      s.normalize()
      s.mean = 1.0
      s.range = 1.0
      assert almostEqual(s.mean, 1.0)
      assert almostEqual(s.range, 1.0)
      assert almostEqual(s.mass, 1.0)
  
      # add and remove points
      # test special cases: SUM(weights)=0, RANGE(samples)=0, SUM(samples)=0
      s.append(point(1.0, -1.0))
      assert s.mean == -inf
      assert almostEqual(s.range, 1.0)
      assert almostEqual(s.mass, 0.0)
  
      """
    _ave = s.mean
    s.mean = 1.0
    assert str(s.mean) == 'nan'
    assert str(s.range) == 'nan'
    assert almostEqual(s.mass, 0.0)
    s.normalize()
    assert str(s.mass) == 'nan'
    s.mean = _ave
    """
  
      s.pop()
      s[0] = point(1.0, 1.0)
      s[1] = point(-1.0, 1.0)
      assert almostEqual(s.mean, 0.0)
      assert almostEqual(s.range, 2.0)
      assert almostEqual(s.mass, 2.0)
      s.normalize()
      s.mean = 1.0
      assert almostEqual(s.mean, 1.0)
      assert almostEqual(s.range, 2.0)
      assert almostEqual(s.mass, 1.0)
  
      s[0] = point(1.0, 1.0)
      s[1] = point(1.0, 1.0)
      assert almostEqual(s.mean, 1.0)
      assert almostEqual(s.range, 0.0)
      assert almostEqual(s.mass, 2.0)
  
      s.range = 1.0
      assert str(s.mean) == "nan"
      assert str(s.range) == "nan"
      assert almostEqual(s.mass, 2.0)
      return
  
file_path: mystic/mystic/tests/test_dirac_measure.py
imports: from mystic.math.discrete import point_mass
  from mystic.math.discrete import measure
  from mystic.math.discrete import product_measure
  from mystic.math.samples import random_samples
  from mystic.math.grid import samplepts
  from mystic.math import almostEqual
  from mystic.math.measures import *
  from mystic.math.measures import _pack, _unpack
label_desc: Use image node_id 2 for calling a global function with example usage: test_set_behavior() without return types