Пример #1
0
def test_objects_primary_expression_entity(patch, tree):
    """
    Ensures ExpressionVisitor.primary_expression works with an entity node
    """
    patch.many(ExpressionVisitor, ['entity'])
    tree.child(0).data = 'entity'
    r = ExpressionVisitor().primary_expression(tree)
    ExpressionVisitor.entity.assert_called_with(tree.entity)
    assert r == ExpressionVisitor.entity()
Пример #2
0
def test_objects_expression_one(patch, tree):
    """
    Ensures ExpressionVisitor.expression works with one node
    """
    patch.many(ExpressionVisitor, ['entity'])
    tree.first_child().data = 'entity'
    tree.children = [1]
    r = ExpressionVisitor().expression(tree)
    ExpressionVisitor.entity.assert_called_with(tree.first_child())
    assert r == ExpressionVisitor.entity()