Beispiel #1
0
    def test_ensure_replace_handle_removes_and_re_adds_workspaces(self, _):
        presenter = PeaksViewerCollectionPresenter(MagicMock())
        presenter.overlay_peaksworkspaces = MagicMock()
        presenter.workspace_names = MagicMock(return_value=["ws"])

        def remove_peaks(ws_name):
            presenter.workspace_names().remove(ws_name)
            return 1
        presenter.remove_peaksworkspace = MagicMock(side_effect=remove_peaks)

        presenter.replace_handle("ws", None)

        presenter.remove_peaksworkspace.assert_called_once_with("ws")
        presenter.overlay_peaksworkspaces.assert_called_once_with(["ws"], index=1)
Beispiel #2
0
    def test_ensure_that_the_ads_observer_calls_replace_handle(self, _):
        presenter = PeaksViewerCollectionPresenter(MagicMock())
        presenter.replace_handle = MagicMock()
        self.assertTrue(isinstance(presenter._ads_observer, SliceViewerADSObserver))
        presenter._ads_observer = SliceViewerADSObserver(presenter.replace_handle, presenter.rename_handle,
                                                         presenter.clear_handle, presenter.delete_handle)

        CreateSampleWorkspace(OutputWorkspace="ws")
        CreateSampleWorkspace(OutputWorkspace="ws")

        presenter.replace_handle.assert_called_once()