예제 #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