Skip to content

Commit

Permalink
Add non-brainreg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Jul 25, 2024
1 parent f090db3 commit 5ad5f8e
Showing 1 changed file with 40 additions and 38 deletions.
78 changes: 40 additions & 38 deletions tests/tests/test_brainmapper/test_transform_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,17 @@ def transformation_widget(make_napari_viewer):
return widget


# @pytest.fixture(scope="function")
# def transformation_widget_with_napari_layers(
# transformation_widget, brainreg_directory
# ):
# points_layer = transformation_widget.viewer.add_points(points)
# transformation_widget.points_layer = points_layer
#
# raw_data = brainreg_directory / "downsampled.tiff"
# raw_data_layer = transformation_widget.viewer.open(raw_data)
# transformation_widget.raw_data = raw_data_layer[0]
# return transformation_widget
@pytest.fixture(scope="function")
def transformation_widget_with_napari_layers(
transformation_widget, brainreg_directory
):
points_layer = transformation_widget.viewer.add_points(points)
transformation_widget.points_layer = points_layer

raw_data = brainreg_directory / "downsampled.tiff"
raw_data_layer = transformation_widget.viewer.open(raw_data)
transformation_widget.raw_data = raw_data_layer[0]
return transformation_widget


@pytest.fixture
Expand Down Expand Up @@ -361,20 +361,21 @@ def test_check_layers_no_raw_data(transformation_widget, mock_display_info):
# )
#
#
# def test_load_brainreg_directory_no_input(
# transformation_widget_with_napari_layers, mocker
# ):
# # Mock dialog to avoid need for UI
# mock_get_save_file_name = mocker.patch(
# "brainglobe_utils.brainmapper.
# transform_widget.QFileDialog.getExistingDirectory"
# )
# mock_get_save_file_name.return_value = ""
#
# transformation_widget_with_napari_layers.load_brainreg_directory()
# assert not hasattr(
# transformation_widget_with_napari_layers.atlas, "atlas_name"
# )
def test_load_brainreg_directory_no_input(
transformation_widget_with_napari_layers, mocker
):
# Mock dialog to avoid need for UI
mock_get_save_file_name = mocker.patch(
"brainglobe_utils.brainmapper.transform_widget.QFileDialog.getExistingDirectory"
)
mock_get_save_file_name.return_value = ""

transformation_widget_with_napari_layers.load_brainreg_directory()
assert not hasattr(
transformation_widget_with_napari_layers.atlas, "atlas_name"
)


#
#
# def test_check_brainreg_directory_correct_metadata(
Expand Down Expand Up @@ -414,19 +415,20 @@ def test_check_layers_no_raw_data(transformation_widget, mock_display_info):
# mock_method.assert_called_once()
#
#
# def test_display_brainreg_directory_warning_calls_display_info(
# transformation_widget_with_napari_layers, mock_display_info
# ):
# transformation_widget_with_napari_layers.
# display_brainreg_directory_warning()
#
# # Assert display_info was called once with the expected arguments
# mock_display_info.assert_called_once_with(
# transformation_widget_with_napari_layers,
# "Not a brainreg directory",
# "This directory does not appear to be a valid brainreg directory. "
# "Please try loading another brainreg output directory.",
# )
def test_display_brainreg_directory_warning_calls_display_info(
transformation_widget_with_napari_layers, mock_display_info
):
transformation_widget_with_napari_layers.display_brainreg_directory_warning()

# Assert display_info was called once with the expected arguments
mock_display_info.assert_called_once_with(
transformation_widget_with_napari_layers,
"Not a brainreg directory",
"This directory does not appear to be a valid brainreg directory. "
"Please try loading another brainreg output directory.",
)


#
#
# def test_analysis(transformation_widget_with_transformed_points):
Expand Down

0 comments on commit 5ad5f8e

Please sign in to comment.