Exemple #1
0
def test_integration():
    test_ast = vy_ast.parse_to_ast("[1+2, 6+7][8-8]")
    expected_ast = vy_ast.parse_to_ast("3")

    folding.fold(test_ast)

    assert vy_ast.compare_nodes(test_ast, expected_ast)
Exemple #2
0
def test_replace_binop_nested_intermediate_underflow():
    test_ast = vy_ast.parse_to_ast("-2**255 * 2 - 10 + 100")
    with pytest.raises(OverflowException):
        folding.fold(test_ast)
Exemple #3
0
def test_replace_decimal_nested_intermediate_underflow():
    test_ast = vy_ast.parse_to_ast(
        "-18707220957835557353007165858768422651595.9365500928 - 1e-10 + 1e-10"
    )
    with pytest.raises(OverflowException):
        folding.fold(test_ast)
Exemple #4
0
def test_replace_decimal_nested_intermediate_underflow():
    test_ast = vy_ast.parse_to_ast(
        "-170141183460469231731687303715884105726.0 - 2.1 + 10.0")
    with pytest.raises(OverflowException):
        folding.fold(test_ast)