def test_consecutive_parenthesis():
    actual = ExpressionParser.parse(to_tokens("((col+1) = 3 AND col2=4)"))
    expected = Parenthesis(
        BooleanCondition(
            "and",
            Condition(Parenthesis(Addition(Column("col"), Integer(1))), "=",
                      Integer(3)),
            Condition(
                Column("col2"),
                "=",
                Integer(4),
            ),
        ))
    assert actual == expected
def test_parenthesis_expression_where_clause():
    actual = WhereClauseParser.parse(to_tokens("(col + 1) = col2"))
    expected = WhereClause(
        Condition(Parenthesis(Addition(Column("col"), Integer(1))), "=",
                  Column("col2")))
    assert actual == expected
def test_chained_addition():
    actual = ExpressionParser.parse(to_tokens("2+4+5"))
    expected = Addition(Integer(2), Addition(Integer(4), Integer(5)))
    assert actual == expected
def test_parenthesis_conditional():
    actual = ExpressionParser.parse(to_tokens("(field+3) = 4"))
    expected = Condition(Parenthesis(Addition(Column("field"), Integer(3))),
                         "=", Integer(4))
    assert actual == expected
def test_addition():
    actual = ExpressionParser.parse(to_tokens("2+4"))
    expected = Addition(Integer(2), Integer(4))
    assert actual == expected