Skip to content

Commit

Permalink
Use export_ws instead
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkeSchomann committed Dec 6, 2024
1 parent 26955a4 commit e138c2e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/workspacemanager_presenter_ads_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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()
Expand Down

0 comments on commit e138c2e

Please sign in to comment.