Esempio n. 1
0
def test_objects_base_expression(patch, tree):
    """
    Ensures Objects.base_expression calls expression
    """
    patch.many(Objects, ['expression'])
    tree.child(0).data = 'expression'
    r = Objects().base_expression(tree)
    Objects.expression.assert_called_with(tree.child(0))
    assert r == Objects.expression()
Esempio n. 2
0
def test_objects_absolute_expression(patch, tree):
    """
    Ensures Objects.absolute_expression calls expression
    """
    patch.many(Objects, ["expression"])
    tree.child(0).data = "expression"
    r = Objects().absolute_expression(tree)
    Objects.expression.assert_called_with(tree.child(0))
    assert r == Objects.expression()
Esempio n. 3
0
def test_objects_argument(patch, tree):
    patch.object(Objects, 'expression')
    result = Objects().argument(tree)
    assert tree.child.call_count == 2
    Objects.expression.assert_called_with(tree.child())
    expected = {
        '$OBJECT': 'arg',
        'name': tree.child().value,
        'arg': Objects.expression()
    }
    assert result == expected
Esempio n. 4
0
def test_objects_argument(patch, tree):
    patch.object(Objects, "expression")
    result = Objects().argument(tree)
    assert tree.child.call_count == 2
    Objects.expression.assert_called_with(tree.child())
    expected = {
        "$OBJECT": "arg",
        "name": tree.child().value,
        "arg": Objects.expression(),
    }
    assert result == expected