Esempio n. 1
0
def test_empty_expression():
    from stilus.nodes.null import null
    from stilus.nodes.boolean import false

    expression = Expression()
    assert len(expression) == 0
    assert expression.is_empty()
    assert expression.first() is null
    assert expression.to_boolean() is false
Esempio n. 2
0
def test_expression_string_first_boolean():
    from stilus.nodes.boolean import true
    from stilus.nodes.boolean import false
    from stilus.nodes.null import null

    expression = Expression()
    expression.append(true)
    expression.append(false)
    expression.append(null)
    assert str(expression) == "(true false null)"
    expression.is_list = True
    assert str(expression) == "(true, false, null)"
    assert expression.first() is true
    assert expression.to_boolean().value is True