Пример #1
0
def test_objects_regular_expression():
    """
    Ensures regular expressions are compiled correctly
    """
    tree = Tree('regular_expression', ['regexp'])
    result = Objects.regular_expression(tree)
    assert result == {'$OBJECT': 'regexp', 'regexp': tree.child(0)}
Пример #2
0
def test_tree_child_overflow():
    tree = Tree('rule', ['child'])
    assert tree.child(1) is None
Пример #3
0
def test_tree_child():
    tree = Tree('rule', ['child'])
    assert tree.child(0) == 'child'
Пример #4
0
def test_tree_child_overflow():
    tree = Tree('rule', ['child'])
    with raises(AssertionError):
        tree.child(1)
Пример #5
0
def test_tree_child_overflow():
    tree = Tree("rule", ["child"])
    with raises(AssertionError):
        tree.child(1)
Пример #6
0
def test_tree_child():
    tree = Tree("rule", ["child"])
    assert tree.child(0) == "child"