From e138c2ed1ad7207e8b1c4f66126eece1498fe059 Mon Sep 17 00:00:00 2001 From: Silke Schomann Date: Fri, 6 Dec 2024 13:36:11 +0000 Subject: [PATCH] Use export_ws instead --- tests/workspacemanager_presenter_ads_test.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/workspacemanager_presenter_ads_test.py b/tests/workspacemanager_presenter_ads_test.py index 83a4f31d..25c3fab7 100644 --- a/tests/workspacemanager_presenter_ads_test.py +++ b/tests/workspacemanager_presenter_ads_test.py @@ -3,28 +3,24 @@ import mock from mock import MagicMock -import numpy as np from mantid.api import AnalysisDataService from mantid.simpleapi import RenameWorkspace from mslice.models.mslice_ads_observer import MSliceADSObserver +from mslice.models.workspacemanager.workspace_algorithms import export_workspace_to_ads from mslice.presenters.interfaces.main_presenter import MainPresenterInterface from mslice.presenters.workspace_manager_presenter import WorkspaceManagerPresenter from mslice.views.interfaces.mainview import MainView from mslice.views.interfaces.workspace_view import WorkspaceView -from mslice.util.mantid.mantid_algorithms import CreateWorkspace -from mslice.util.mantid.algorithm_wrapper import add_to_ads +from tests.testhelpers.workspace_creator import create_workspace class WorkspaceManagerPresenterTest(unittest.TestCase): @classmethod def setUpClass(cls): - x = np.linspace(0, 99, 100) - y = x * 1 - e = y * 0 + 2 - cls.m_workspace = CreateWorkspace(x, y, e, OutputWorkspace="ws") + cls.test_workspace = create_workspace('ws') def setUp(self): self.view = mock.create_autospec(spec=WorkspaceView) @@ -40,7 +36,7 @@ def test_ensure_that_the_ads_observer_calls_delete_handle(self): presenter.delete_handle, presenter.clear_handle, presenter.rename_handle ) - add_to_ads(self.m_workspace) + export_workspace_to_ads(self.test_workspace) AnalysisDataService.remove("ws") presenter.delete_handle.assert_called_once_with("ws") @@ -53,7 +49,7 @@ def test_ensure_that_the_ads_observer_calls_rename_handle(self): presenter.delete_handle, presenter.clear_handle, presenter.rename_handle ) - add_to_ads(self.m_workspace) + export_workspace_to_ads(self.test_workspace) RenameWorkspace(InputWorkspace="ws", OutputWorkspace="ws1") presenter.rename_handle.assert_called_once_with("ws", "ws1") @@ -66,7 +62,7 @@ def test_ensure_that_the_ads_observer_calls_clear_handle(self): presenter.delete_handle, presenter.clear_handle, presenter.rename_handle ) - add_to_ads(self.m_workspace) + export_workspace_to_ads(self.test_workspace) AnalysisDataService.clear(True) presenter.clear_handle.assert_called_once()