Beispiel #1
0
    def test_ensure_clear_handle_removes_all_workspaces(self, _):
        presenter = PeaksViewerCollectionPresenter(MagicMock())
        presenter.remove_peaksworkspace = MagicMock()
        presenter.workspace_names = MagicMock(return_value=["ws", "ws1", "ws2"])

        presenter.clear_handle()

        presenter.remove_peaksworkspace.assert_any_call("ws")
        presenter.remove_peaksworkspace.assert_any_call("ws1")
        presenter.remove_peaksworkspace.assert_any_call("ws2")
        self.assertEqual(3, presenter.remove_peaksworkspace.call_count)
Beispiel #2
0
    def test_ensure_that_the_ads_observer_calls_clear_handle(self, _):
        presenter = PeaksViewerCollectionPresenter(MagicMock())
        presenter.clear_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")
        ADS.clear()

        presenter.clear_handle.assert_called_once()