예제 #1
0
def test_clean_tree():
    tree = RBush(4)
    tree.load(data_array)

    for i in range(len(data_array)):
        tree.remove(*data_array[i])

    assert tree.height == 1
    assert tree.to_json() == RBush(4).to_json()
예제 #2
0
def test_remove_nothing():
    # 'remove' does nothing if nothing found
    tree1 = RBush()
    tree1.load(data_array)
    tree2 = RBush()
    tree2.load(data_array)

    tree2.remove(13, 13, 13, 13)

    items1, _ = tree1.all()
    items2, _ = tree2.all()

    assert sorted_equal(items1, items2)
예제 #3
0
def test_remove_items():
    tree = RBush(4)
    tree.load(data_array)

    len_ = len(data_array)
    items_removed = []
    items_removed.extend(tree.remove(*data_array[0]))
    items_removed.extend(tree.remove(*data_array[1]))
    items_removed.extend(tree.remove(*data_array[2]))

    items_removed = np.asarray([i[0] for i in items_removed])

    items, _ = tree.all()

    assert sorted_equal(data_array[3:], items)
    assert sorted_equal(data_array[:3], items_removed)