Skip to content

Commit

Permalink
Spectrum widget test fix (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSullivan7 authored Nov 18, 2024
2 parents e027cbb + 50e7cad commit 26ae982
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/release_notes/next/fix-2309-spectrum-widget-test-fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#2309: Fix SpectrumWidgetTest warnings
9 changes: 4 additions & 5 deletions mantidimaging/gui/windows/spectrum_viewer/spectrum_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,12 @@ def set_tof_axis_label(self, tof_axis_label: str) -> None:
class SpectrumProjectionWidget(GraphicsLayoutWidget):
image: MIMiniImageView

def __init__(self, parent: MainWindowView) -> None:
super().__init__(parent)
self._main_window = parent
def __init__(self, main_window: MainWindowView) -> None:
super().__init__()
self.image = MIMiniImageView(name="Projection", view_box_type=CustomViewBox)
self.addItem(self.image, 0, 0)
self.ci.layout.setRowStretchFactor(0, 3)

nan_check_menu = [("Crop Coordinates", lambda: self._main_window.presenter.show_operation("Crop Coordinates")),
("NaN Removal", lambda: self._main_window.presenter.show_operation("NaN Removal"))]
nan_check_menu = [("Crop Coordinates", lambda: main_window.presenter.show_operation("Crop Coordinates")),
("NaN Removal", lambda: main_window.presenter.show_operation("NaN Removal"))]
self.image.enable_nan_check(actions=nan_check_menu)
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def test_WHEN_colour_is_not_valid_THEN_roi_colour_is_unchanged(self):
class SpectrumWidgetTest(unittest.TestCase):

def setUp(self) -> None:
with mock.patch("mantidimaging.gui.windows.main.view.WelcomeScreenPresenter"):
self.main_window = MainWindowView()
self.main_window = mock.create_autospec(MainWindowView)
self.view = mock.create_autospec(SpectrumViewerWindowView)
self.view.current_dataset_id = uuid.uuid4()
self.view.parent = mock.create_autospec(SpectrumViewerWindowPresenter)
Expand Down

0 comments on commit 26ae982

Please sign in to comment.