Esempio n. 1
0
def test_nodes():
    A, B = [compare.AnnotatedTree(t, t.get_children) for t in simple_trees()]
    for i, n in enumerate(reversed(A.nodes)):
        assert hasattr(n, '_id')
        assert n._id == i
    for i, n in enumerate(reversed(B.nodes)):
        assert hasattr(n, '_id')
        assert n._id == i
Esempio n. 2
0
def test_left_most_descendent():
    A, B = [compare.AnnotatedTree(t, t.get_children) for t in simple_trees()]
    assert A.lmds[0] == 0
    assert A.lmds[1] == 1
    assert A.lmds[2] == 1
    assert A.lmds[3] == 0
    assert A.lmds[4] == 4
    assert A.lmds[5] == 0

    assert B.lmds[0] == 0
    assert B.lmds[1] == 1
    assert B.lmds[2] == 0
    assert B.lmds[3] == 0
    assert B.lmds[4] == 4
    assert B.lmds[5] == 0
Esempio n. 3
0
def test_keyroots():
    A, B = [compare.AnnotatedTree(t, t.get_children) for t in simple_trees()]
    assert A.keyroots == [2, 4, 5]
    assert B.keyroots == [1, 4, 5]
Esempio n. 4
0
def test_nodes():
    A, B = [compare.AnnotatedTree(t, t.get_children) for t in simple_trees()]
    for i, nid in enumerate(reversed(A.ids)):
        assert nid == i
    for i, nid in enumerate(reversed(B.ids)):
        assert nid == i