Example #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)}
Example #2
0
def test_tree_child_overflow():
    tree = Tree('rule', ['child'])
    assert tree.child(1) is None
Example #3
0
def test_tree_child():
    tree = Tree('rule', ['child'])
    assert tree.child(0) == 'child'
Example #4
0
def test_tree_child_overflow():
    tree = Tree('rule', ['child'])
    with raises(AssertionError):
        tree.child(1)
Example #5
0
def test_tree_child_overflow():
    tree = Tree("rule", ["child"])
    with raises(AssertionError):
        tree.child(1)
Example #6
0
def test_tree_child():
    tree = Tree("rule", ["child"])
    assert tree.child(0) == "child"