From 5656bdddfd17a9b73467ade85c95dc953d84e91b Mon Sep 17 00:00:00 2001 From: SVivdich02 Date: Sun, 25 Feb 2024 15:54:06 +0300 Subject: [PATCH] refactoring tests --- tests/distance/test_connected_component.py | 8 +++++--- tests/distance/test_isolated.py | 4 ++-- tests/utils/test_distance_matrix.py | 20 +++++++++++++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/distance/test_connected_component.py b/tests/distance/test_connected_component.py index ba9020d..38bd345 100644 --- a/tests/distance/test_connected_component.py +++ b/tests/distance/test_connected_component.py @@ -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( @@ -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() diff --git a/tests/distance/test_isolated.py b/tests/distance/test_isolated.py index fd56964..5638c04 100644 --- a/tests/distance/test_isolated.py +++ b/tests/distance/test_isolated.py @@ -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() diff --git a/tests/utils/test_distance_matrix.py b/tests/utils/test_distance_matrix.py index 70b9b40..c85a00f 100644 --- a/tests/utils/test_distance_matrix.py +++ b/tests/utils/test_distance_matrix.py @@ -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()