def test_add_child_after(root, grid):
    """Test adding nodes in specific positions."""
    a, b, c, d, e = grid
    f = Node("f")
    g = Node("g")
    h = Node("h")
    # add_child is called on the target node's parent
    # i.e. the node containing the target
    root.add_child_after(f, a)
    assert root.tree == [a, f, [b, [c, d, e]]]
    b.parent.add_child_after(g, b)
    assert root.tree == [a, f, [b, g, [c, d, e]]]
    d.parent.add_child_after(h, d)
    assert root.tree == [a, f, [b, g, [c, d, h, e]]]
Test adding nodes in specific positions.
test/layouts/test_plasma.py