Skip to content

Commit

Permalink
Remove unused SpectrumViewerWindowPresenter.rename_roi()
Browse files Browse the repository at this point in the history
And associated tests. (previous commit check this with a system test)
  • Loading branch information
samtygier-stfc committed Feb 24, 2025
1 parent 91fee71 commit 54b2947
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
9 changes: 0 additions & 9 deletions mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,6 @@ def do_add_roi_to_table(self, roi_name: str) -> None:
roi_colour = self.view.spectrum_widget.roi_dict[roi_name].colour
self.view.add_roi_table_row(roi_name, roi_colour)

def rename_roi(self, old_name: str, new_name: str) -> None:
"""
Rename a given ROI from the table by ROI name
@param old_name: Name of the ROI to rename
@param new_name: New name of the ROI
"""
self.view.spectrum_widget.rename_roi(old_name, new_name)

def do_remove_roi(self, roi_name: str | None = None) -> None:
"""
Remove a given ROI from the table by ROI name or all ROIs from
Expand Down
15 changes: 0 additions & 15 deletions mantidimaging/gui/windows/spectrum_viewer/test/presenter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,6 @@ def test_WHEN_rits_roi_clicked_THEN_rois_not_updated(self):
self.assertEqual(self.view.table_view.last_clicked_roi, "NOT_RITS_ROI")
self.view.set_roi_properties.assert_not_called()

def test_WHEN_ROI_renamed_THEN_roi_renamed(self):
rois = ["all", "roi", "roi_1"]
self.view.spectrum_widget.rois = {roi: mock.Mock() for roi in rois}
self.view.spectrum_widget.rename_roi = mock.Mock()
self.presenter.rename_roi("roi_1", "new_name")

self.view.spectrum_widget.rename_roi.assert_called_once_with("roi_1", "new_name")

def test_WHEN_invalid_ROI_renamed_THEN_error_raised(self):
rois = ["all", "roi", "roi_1"]
self.view.spectrum_widget.roi_dict = {roi: mock.Mock() for roi in rois}
self.view.spectrum_widget.rename_roi = mock.Mock(side_effect=KeyError("Invalid ROI"))
with self.assertRaises(KeyError):
self.presenter.rename_roi("invalid_roi", "new_name")

def test_WHEN_do_remove_roi_called_with_no_arguments_THEN_all_rois_removed(self):
rois = ["all", "roi", "roi_1", "roi_2"]
self.view.spectrum_widget.roi_dict = {roi: mock.Mock() for roi in rois}
Expand Down

0 comments on commit 54b2947

Please sign in to comment.