예제 #1
0
def value_of_boolean_not_operation_is_type_checked():
    assert_subexpression_is_type_checked(lambda bad_ref: nodes.bool_not(bad_ref))
예제 #2
0
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")
예제 #3
0
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))
예제 #4
0
 def test_transform_boolean_not(self):
     _assert_transform(
         nodes.bool_not(nodes.ref("x")),
         cc.not_(cc.call(cc.builtin("bool"), [cc.ref("x")])),
     )