def test_that_non_existent_ws_creates_error_message(self): # Arrange ws_name = 'original' ws_clone_name = 'clone' # Act message, complete = su.create_zero_error_free_workspace(input_workspace_name = ws_name, output_workspace_name = ws_clone_name) # Assert message.strip() self.assertTrue(message) self.assertTrue(not complete)
def test_that_bad_zero_error_removal_creates_error_message(self): # Arrange ws_name = 'original' ws_clone_name = 'clone' self._setup_workspace(ws_name, 'Event') # Act message, complete= su.create_zero_error_free_workspace(input_workspace_name = ws_name, output_workspace_name = ws_clone_name) # Assert message.strip() self.assertTrue(message) self.assertTrue(not ws_clone_name in mtd) self.assertTrue(not complete) self._removeWorkspace(ws_name) self.assertTrue(not ws_name in mtd)
def test_that_zeros_are_removed_correctly(self): # Arrange ws_name = 'original' ws_clone_name = 'clone' self._setup_workspace(ws_name, 'Histogram') # Act message, complete = su.create_zero_error_free_workspace(input_workspace_name = ws_name, output_workspace_name = ws_clone_name) # Assert message.strip() print message # self.assertTrue(not message) #self.assertTrue(complete) self.assertTrue(mtd[ws_name] != mtd[ws_clone_name]) self._removeWorkspace(ws_name) self._removeWorkspace(ws_clone_name) self.assertTrue(not ws_name in mtd) self.assertTrue(not ws_clone_name in mtd)
def get_mapped_workspaces(save_names, save_as_zero_error_free): """ Get a workspace name map, which maps from the original workspace to a zero-error-free cloned workspace if save_as_zero_error_free is checked otherwise the workspaces are mapped to themselves. @param save_names: a list of workspace names @param save_as_zero_error_free : if the user wants the zero-errors removed @returns a map of workspaces """ workspace_dictionary = {} for name in save_names: if save_as_zero_error_free: cloned_name = name + '_cloned_temp' dummy_message, complete = su.create_zero_error_free_workspace(input_workspace_name = name, output_workspace_name = cloned_name) if complete: workspace_dictionary[name] = cloned_name else: workspace_dictionary[name] = name else: workspace_dictionary[name] = name return workspace_dictionary