def value_of_boolean_not_operation_is_type_checked(): assert_subexpression_is_type_checked(lambda bad_ref: nodes.bool_not(bad_ref))
def test_parse_simple_boolean_operators(): x = nodes.ref("x") y = nodes.ref("y") _assert_expression_parse(nodes.bool_and(x, y), "x and y") _assert_expression_parse(nodes.bool_or(x, y), "x or y") _assert_expression_parse(nodes.bool_not(x), "not x")
def type_of_boolean_not_operation_is_boolean(): type_bindings = {"x": types.int_type} operation = nodes.bool_not(nodes.ref("x")) assert_equal(types.bool_type, infer(operation, type_bindings=type_bindings))
def test_transform_boolean_not(self): _assert_transform( nodes.bool_not(nodes.ref("x")), cc.not_(cc.call(cc.builtin("bool"), [cc.ref("x")])), )