Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Jul 23, 2024
1 parent 525c256 commit b41e9c3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion brainglobe_utils/brainmapper/transform_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ def run_transform_downsampled_points_to_atlas_space(self):
display_info(
self,
"Points outside atlas",
f"{len(points_out_of_bounds)} fell outside the atlas space",
f"{len(points_out_of_bounds)} "
f"points fell outside the atlas space",
)

def get_downsampled_space(self):
Expand Down
24 changes: 24 additions & 0 deletions tests/tests/test_brainmapper/test_transform_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
]
)

points_outside_brain = np.array(
[
[10000, 10000, 10000],
[100001, 100001, 100001],
]
)


points_in_downsampled_space = np.array(
[
[10.0, 68.0, 105.0],
Expand Down Expand Up @@ -264,6 +272,22 @@ def test_transform_points_to_atlas_space(
)


def test_transformation_raises_info_points_out_of_bounds(
transformation_widget_with_data, mock_display_info
):
points_layer = transformation_widget_with_data.viewer.add_points(
points_outside_brain
)
transformation_widget_with_data.points_layer = points_layer
transformation_widget_with_data.run_transform_points_to_downsampled_space()
transformation_widget_with_data.run_transform_downsampled_points_to_atlas_space()
mock_display_info.assert_called_once_with(
transformation_widget_with_data,
"Points outside atlas",
"2 points fell outside the atlas space",
)


def test_check_layers(transformation_widget_with_data):
assert transformation_widget_with_data.check_layers()

Expand Down

0 comments on commit b41e9c3

Please sign in to comment.