def test_that_returns_none_if_it_does_not_exist(self): # Arrange test_director = TestDirector() state = test_director.construct() StateFunctionsTest._prepare_workspaces(number_of_workspaces=4, tagged_workspace_names=None, state=state) # Act workspace, workspace_count, workspace_norm = get_reduced_can_workspace_from_ads(state, output_parts=False) # Assert self.assertTrue(workspace is None) self.assertTrue(workspace_count is None) self.assertTrue(workspace_norm is None) # Clean up StateFunctionsTest._remove_workspaces()
def _get_state(): test_director = TestDirector() state = test_director.construct() state.data.sample_scatter_run_number = 12345 state.data.sample_scatter_period = StateData.ALL_PERIODS state.reduction.dimensionality = ReductionDimensionality.OneDim state.wavelength.wavelength_low = 12.0 state.wavelength.wavelength_high = 34.0 state.mask.phi_min = 12.0 state.mask.phi_max = 56.0 state.slice.start_time = [4.56778] state.slice.end_time = [12.373938] return state
def test_that_can_find_can_reduction_if_it_exists(self): # Arrange test_director = TestDirector() state = test_director.construct() tagged_workspace_names = {None: "test_ws", OutputParts.Count: "test_ws_count", OutputParts.Norm: "test_ws_norm"} StateFunctionsTest._prepare_workspaces(number_of_workspaces=4, tagged_workspace_names=tagged_workspace_names, state=state) # Act workspace, workspace_count, workspace_norm = get_reduced_can_workspace_from_ads(state, output_parts=True) # Assert self.assertTrue(workspace is not None) self.assertTrue(workspace.name() == AnalysisDataService.retrieve("test_ws").name()) self.assertTrue(workspace_count is not None) self.assertTrue(workspace_count.name() == AnalysisDataService.retrieve("test_ws_count").name()) self.assertTrue(workspace_norm is not None) self.assertTrue(workspace_norm.name() == AnalysisDataService.retrieve("test_ws_norm").name()) # Clean up StateFunctionsTest._remove_workspaces()