def func(c, t): op = get_operator(c, x.astype(t)) c_ = type(op) if c_ in (IdentityOperator, ZeroOperator): expected_dtype = int elif c_ is MaskOperator: expected_dtype = bool else: expected_dtype = t assert_equal(op.data.dtype, expected_dtype) if c_ in (IdentityOperator, MaskOperator, ZeroOperator): assert_equal(op.dtype, None) elif c_ is DiagonalNumexprOperator: assert_equal(op.dtype, float_dtype(t)) else: assert_equal(op.dtype, t)
def func(dtype, expected): if expected is None: assert_raises(TypeError, float_dtype, dtype) else: actual = float_dtype(dtype) assert_eq(actual, expected)