def scalar_less(): A = numeric.asarray(1) B = numeric.asarray(2.) assert A < B, 'A<B' assert A <= B, 'A<=B' assert not A >= B, '!A>=B' assert not A > B, '!A>B'
def bisection(): target1 = numeric.arange(1,3) target2 = numeric.arange(1,4) arrays = [ target1, 2, False, numeric.asarray([1,3]), None, (), numeric.asarray([5]), target2 ] arrays.sort() i1 = numeric.bisect( arrays, target1 ) assert arrays[i1] == target1, 'target1' i2 = numeric.bisect( arrays, target2 ) assert arrays[i2] == target2, 'target2'
def scalar_equal_int_float(): A = numeric.asarray(1) B = 1. assert A == B, 'A==B' assert B == A, 'B==A'
def retrieve_from_dict(): A = numeric.arange(1,3) B = numeric.arange(3,5) d = { A: 1, B: 2 } assert d[ numeric.asarray([1,2]) ] == 1, 'A' assert d[ numeric.asarray([3,4]) ] == 2, 'B'
def scalar_notequal_int_other_float(): A = numeric.asarray(1) B = 2. assert A != B, 'A!=B' assert B != A, 'B!=A'