def rand_bool(dims, mean): values = random_value_array_from_dims(dims, mean=mean) values = abs(values).astype(np.int32) return values
class Test_binary_ops_and(Test_binary_ops): op = operator.and_ randfunc = [rand_bool] def test_7(self): v1 = VArray(self.randfunc[0]((self.fi, self.gi, self.ri), mean=10)) v2 = 5 a1 = np.array(v1) self._check(v1, v2, a1, v2) class Test_binary_ops_or(Test_binary_ops_and): op = operator.or_ class Test_binary_ops_xor(Test_binary_ops_and): op = operator.xor if __name__ == '__main__': fi = aobj.DimSweep("f", 3) gi = aobj.DimSweep("g", 4) ri = aobj.DimRep("r", 5) v1 = random_value_array_from_dims((fi, gi, ri), mean=10) v2 = VArray(random_value_array_from_dims((gi,), mean=10)) a1 = np.array(v1) a2 = np.array(v2)[:, newaxis]