示例#1
0
def test_identity_isnot_body_var():
    assert lambda_is_identity(ast.parse("lambda x: x1")) is False
示例#2
0
def test_identity_is():
    assert lambda_is_identity(ast.parse("lambda x: x")) is True
示例#3
0
def test_identity_isnot_args():
    assert lambda_is_identity(ast.parse("lambda x,y: x")) is False
示例#4
0
def make_Select(source, selection):
    'Make a select, and return source is selection is an identity'
    return source if lambda_is_identity(selection) else Select(
        source, selection)
def make_Select(source: ast.AST, selection: ast.AST):
    'Make a select, and return source is selection is an identity'
    return source if lambda_is_identity(selection) else function_call(
        'Select', [source, selection])
示例#6
0
def test_identity_isnot_body_var():
    assert lambda_is_identity(ast.parse('lambda x: x1')) == False
示例#7
0
def test_identity_isnot_args():
    assert lambda_is_identity(ast.parse('lambda x,y: x')) == False
示例#8
0
def test_identity_is():
    assert lambda_is_identity(ast.parse('lambda x: x')) == True