Skip to content

Commit

Permalink
Improve test coverage of graph from nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmalinmayor committed Jun 18, 2024
1 parent 12f8217 commit 24bf2fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions tests/test_candidate_graph/test_compute_graph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from collections import Counter

import numpy as np
import pytest
from motile_toolbox.candidate_graph import EdgeAttr, get_candidate_graph
from motile_toolbox.candidate_graph.compute_graph import (
get_candidate_graph_from_points_list,
)


def test_graph_from_segmentation_2d(segmentation_2d, graph_2d):
Expand Down Expand Up @@ -82,3 +86,18 @@ def test_graph_from_multi_segmentation_2d(
assert Counter(list(cand_graph.edges)) == Counter(
[("0_0_1", "1_0_2"), ("0_0_1", "1_1_2"), ("0_1_1", "1_1_2")]
)


def test_graph_from_points_list():
points_list = np.array(
[
[0, 1, 1, 1],
[2, 3, 3, 3],
[1, 2, 2, 2],
[2, 6, 6, 6],
[2, 1, 1, 1],
]
)
cand_graph = get_candidate_graph_from_points_list(points_list, max_edge_distance=3)
assert cand_graph.number_of_edges() == 3
assert len(cand_graph.in_edges(3)) == 0
2 changes: 1 addition & 1 deletion tests/test_candidate_graph/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_compute_node_frame_dict(graph_2d):
assert node_frame_dict == expected


def test_nodes_from_points_list_2d(graph_2d):
def test_nodes_from_points_list_2d():
points_list = np.array(
[
[0, 1, 2, 3],
Expand Down

0 comments on commit 24bf2fe

Please sign in to comment.