Exemplo n.º 1
0
def test_LabelledPointUndirectedGraph_add_label():
    lgroup = LabelledPointUndirectedGraph(points, adjacency_matrix, mask_dict_2)

    new_lgroup = lgroup.add_label('lower2', [0, 1])
    assert not is_same_array(new_lgroup.points, lgroup.points)

    lower_pcloud = new_lgroup.get_label('lower2')
    assert lower_pcloud.n_points == 2
    assert_allclose(lower_pcloud.points[0, :], [1., 1., 1.])
    assert_allclose(lower_pcloud.points[1, :], [1., 1., 1.])
Exemplo n.º 2
0
def test_LabelledPointUndirectedGraph_add_ordered_labels():
    lgroup = LabelledPointUndirectedGraph(points, adjacency_matrix, mask_dict_2)

    labels = lgroup.labels
    assert labels[0] == 'lower'
    assert labels[1] == 'upper'

    new_lgroup = lgroup.add_label('A', [0, 1])
    new_labels = new_lgroup.labels

    assert new_labels[2] == 'A'