def test_replace_binop_nested(): test_ast = vy_ast.parse_to_ast("((6 + (2**4)) * 4) / 2") expected_ast = vy_ast.parse_to_ast("44") folding.replace_literal_ops(test_ast) assert vy_ast.compare_nodes(test_ast, expected_ast)
def test_replace_literal_ops(): test_ast = vy_ast.parse_to_ast("[not True, True and False, True or False]") expected_ast = vy_ast.parse_to_ast("[False, False, True]") folding.replace_literal_ops(test_ast) assert vy_ast.compare_nodes(test_ast, expected_ast)
def test_replace_binop_simple(): test_ast = vy_ast.parse_to_ast("1 + 2") expected_ast = vy_ast.parse_to_ast("3") folding.replace_literal_ops(test_ast) assert vy_ast.compare_nodes(test_ast, expected_ast)