Skip to content

Commit

Permalink
refactoring tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SVivdich02 committed Feb 25, 2024
1 parent a8eb48a commit 5656bdd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
8 changes: 5 additions & 3 deletions tests/distance/test_connected_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import pytest
import open3d as o3d

from src.services.distance.connected_component import ExtractionLargestConnectedComponentProcessor
from src.services.distance.connected_component import (
ExtractionLargestConnectedComponentProcessor,
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -98,8 +100,8 @@ def test_extract_largest_connected_component(
expected_points,
expected_trace,
):
actual_dist, actual_points, actual_trace = ExtractionLargestConnectedComponentProcessor().process(
dist, points, trace
actual_dist, actual_points, actual_trace = (
ExtractionLargestConnectedComponentProcessor().process(dist, points, trace)
)

assert (actual_dist == expected_dist).all()
Expand Down
4 changes: 2 additions & 2 deletions tests/distance/test_isolated.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def test_remove_isolated_points(
expected_points,
expected_trace,
):
actual_dist, actual_points, actual_trace = RemovingIsolatedPointsProcessor().process(
dist, points, trace
actual_dist, actual_points, actual_trace = (
RemovingIsolatedPointsProcessor().process(dist, points, trace)
)

assert (actual_dist == expected_dist).all()
Expand Down
20 changes: 17 additions & 3 deletions tests/utils/test_distance_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,28 @@ def test_dfs(distance_matrix):
actual_visited_vertices_1 = dfs(distance_matrix, start_vertex=1)
expected_visited_vertices_1 = np.array(
[
True, True, True, False, False, False, False, False,
True,
True,
True,
False,
False,
False,
False,
False,
]
)

actual_visited_vertices_7 = dfs(distance_matrix, start_vertex=4)
actual_visited_vertices_7 = dfs(distance_matrix, start_vertex=7)
expected_visited_vertices_7 = np.array(
[
False, False, False, True, True, True, True, True,
False,
False,
False,
True,
True,
True,
True,
True,
]
)
assert (actual_visited_vertices_1 == expected_visited_vertices_1).all()
Expand Down

0 comments on commit 5656bdd

Please sign in to comment.