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