def test_get_wksp_index_and_spec_num_1_histogram_axis_bin(self): """ Test getting the WorkspaceIndex and Spectrum Number for a Workspace with 1 histogram, when traversing the BIN axis """ ws = CreateSingleValuedWorkspace() axis = MantidAxType.BIN res_workspace_index, res_spectrum_number, res_kwargs = funcs._get_wksp_index_and_spec_num(ws, axis) self.assertEqual(0, res_workspace_index) self.assertEqual(None, res_spectrum_number)
def test_get_wksp_index_and_spec_num_with_wkspIndex_axis_spectrum(self): """ Test getting the WorkspaceIndex and Spectrum Number for a Workspace, when traversing the SPECTRUM axis This test provides a workspace index, and expects the spectrum number to be correct """ ws = CreateSampleWorkspace() axis = MantidAxType.SPECTRUM res_workspace_index, res_spectrum_number, res_kwargs = funcs._get_wksp_index_and_spec_num(ws, axis, wkspIndex=5) self.assertEqual(5, res_workspace_index) self.assertEqual(6, res_spectrum_number)
def test_get_wksp_index_and_spec_num_with_specNum_axis_bin(self): """ Test getting the WorkspaceIndex and Spectrum Number for a Workspace when traversing the BIN axis This test provides a spectrum number and expects the workspace index to be correct """ ws = CreateSampleWorkspace() axis = MantidAxType.BIN res_workspace_index, res_spectrum_number, res_kwargs = funcs._get_wksp_index_and_spec_num(ws, axis, specNum=3) self.assertEqual(2, res_workspace_index) self.assertEqual(3, res_spectrum_number)