Beispiel #1
0
def assert_rebalanced(tree):
    exp_tree = Tree(copy.deepcopy(tree.vos), tree.label_grid)

    tree.init()
    exp_tree.init()

    np.testing.assert_equal(tree.tree, exp_tree.tree)
Beispiel #2
0
def test_build(vos, label_grid):
    tree = Tree(vos, label_grid)
    tree.init()
    exp_tree = {
        "d0": {
            1: {0, 1},
            2: {2},
            3: {3}
        },
        "d1": {
            "hello": {0, 2},
            "world": {1, 3}
        },
    }
    np.testing.assert_equal(tree.tree, exp_tree)