예제 #1
0
def test_attribute_array():
    assert DefaultParser().parse('["foo", "bar"].length') == Identifier(
        value='length', subject=ArrayLiteral([Literal('foo'),
                                              Literal('bar')]))
예제 #2
0
def test_nexted_array_literals():
    assert DefaultParser().parse('["foo", ["bar", "tek"]]') == ArrayLiteral(
        [Literal('foo'),
         ArrayLiteral([Literal('bar'), Literal('tek')])])
예제 #3
0
def test_empty_array_literals():
    assert DefaultParser().parse('[]') == ArrayLiteral([])
예제 #4
0
def test_array_literals():
    assert DefaultParser().parse('["foo", 1+2]') == ArrayLiteral([
        Literal('foo'),
        BinaryExpression(operator=_ops['+'], left=Literal(1), right=Literal(2))
    ])