Example #1
0
 def copyTest (self):
     "Test how MA works with the copy module."
     import copy
     x = MA.array([1,2,3])
     y = [1, x, 3]
     c1 = copy.copy(x)
     assert MA.allclose(x,c1)
     x[1] = 4
     assert not MA.allclose(x,c1)
     c2 = copy.copy(y)
     assert id(c2[1]) == id(x)
     c3 = copy.deepcopy(y)
     assert id(c3[1]) != id(x)
     assert MA.allclose(c3[1], x)
Example #2
0
def eq (a, b):
    "Test if the two sequences are essentially equal"
    return MA.allclose(a,b)