Ejemplo n.º 1
0
def test_identity_isnot_body_var():
    assert lambda_is_identity(ast.parse("lambda x: x1")) is False
Ejemplo n.º 2
0
def test_identity_is():
    assert lambda_is_identity(ast.parse("lambda x: x")) is True
Ejemplo n.º 3
0
def test_identity_isnot_args():
    assert lambda_is_identity(ast.parse("lambda x,y: x")) is False
Ejemplo n.º 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])
Ejemplo n.º 6
0
def test_identity_isnot_body_var():
    assert lambda_is_identity(ast.parse('lambda x: x1')) == False
Ejemplo n.º 7
0
def test_identity_isnot_args():
    assert lambda_is_identity(ast.parse('lambda x,y: x')) == False
Ejemplo n.º 8
0
def test_identity_is():
    assert lambda_is_identity(ast.parse('lambda x: x')) == True