def operands_of_is_operation_are_type_checked(): assert_subexpression_is_type_checked(lambda bad_ref: nodes.is_(bad_ref, nodes.int_literal(1))) assert_subexpression_is_type_checked(lambda bad_ref: nodes.is_(nodes.int_literal(1), bad_ref))
def test_parse_is_operation(): _assert_expression_parse(nodes.is_(nodes.ref("x"), nodes.ref("y")), "x is y")
def type_of_is_operation_is_boolean(): type_bindings = {"x": types.object_type, "y": types.str_type} operation = nodes.is_(nodes.ref("x"), nodes.ref("y")) assert_equal(types.bool_type, infer(operation, type_bindings=type_bindings))
def test_transform_is_operator(self): _assert_transform( nodes.is_(nodes.ref("x"), nodes.ref("y")), cc.is_(cc.ref("x"), cc.ref("y")), )