@@ -152,49 +152,121 @@ def test_prepareUnfocusedData(self):
152152
153153 # TODO: All units are tested here for now, this will be changed when EWM 6615 is completed
154154 units = "dSpacing"
155- msg = f"Converting unfocused data to { units } "
156155 recipe ._prepareUnfocusedData (workspace , None , units )
157156 outputWs = (
158157 wng .run ().runNumber ("555" ).lite (True ).unit (wng .Units .DSP ).group (wng .Groups .UNFOC ).hidden (True ).build ()
159158 )
160- recipe .mantidSnapper .ConvertUnits .assert_called_once_with (
161- msg , InputWorkspace = outputWs , OutputWorkspace = outputWs , Target = units
159+ recipe .mantidSnapper .ConvertUnits .assert_has_calls (
160+ [
161+ mock .call (
162+ "Converting unfocused data to TOF" ,
163+ InputWorkspace = outputWs ,
164+ OutputWorkspace = outputWs ,
165+ Target = "TOF" ,
166+ ),
167+ mock .call (
168+ "Converting unfocused data to dSpacing" ,
169+ InputWorkspace = outputWs ,
170+ OutputWorkspace = outputWs ,
171+ Target = "dSpacing" ,
172+ ),
173+ mock .call (
174+ f"Converting unfocused data to { units } " ,
175+ InputWorkspace = outputWs ,
176+ OutputWorkspace = outputWs ,
177+ Target = units ,
178+ ),
179+ ]
162180 )
163181 recipe .mantidSnapper .executeQueue .assert_called ()
164182 recipe .mantidSnapper .reset_mock ()
165183
166184 units = "MomentumTransfer"
167- msg = f"Converting unfocused data to { units } "
168185 recipe ._prepareUnfocusedData (workspace , None , units )
169186 outputWs = (
170187 wng .run ().runNumber ("555" ).lite (True ).unit (wng .Units .QSP ).group (wng .Groups .UNFOC ).hidden (True ).build ()
171188 )
172- recipe .mantidSnapper .ConvertUnits .assert_called_once_with (
173- msg , InputWorkspace = outputWs , OutputWorkspace = outputWs , Target = units
189+ recipe .mantidSnapper .ConvertUnits .assert_has_calls (
190+ [
191+ mock .call (
192+ "Converting unfocused data to TOF" ,
193+ InputWorkspace = outputWs ,
194+ OutputWorkspace = outputWs ,
195+ Target = "TOF" ,
196+ ),
197+ mock .call (
198+ "Converting unfocused data to dSpacing" ,
199+ InputWorkspace = outputWs ,
200+ OutputWorkspace = outputWs ,
201+ Target = "dSpacing" ,
202+ ),
203+ mock .call (
204+ f"Converting unfocused data to { units } " ,
205+ InputWorkspace = outputWs ,
206+ OutputWorkspace = outputWs ,
207+ Target = units ,
208+ ),
209+ ]
174210 )
175211 recipe .mantidSnapper .executeQueue .assert_called ()
176212 recipe .mantidSnapper .reset_mock ()
177213
178214 units = "Wavelength"
179- msg = f"Converting unfocused data to { units } "
180215 recipe ._prepareUnfocusedData (workspace , None , units )
181216 outputWs = (
182217 wng .run ().runNumber ("555" ).lite (True ).unit (wng .Units .LAM ).group (wng .Groups .UNFOC ).hidden (True ).build ()
183218 )
184- recipe .mantidSnapper .ConvertUnits .assert_called_once_with (
185- msg , InputWorkspace = outputWs , OutputWorkspace = outputWs , Target = units
219+ recipe .mantidSnapper .ConvertUnits .assert_has_calls (
220+ [
221+ mock .call (
222+ "Converting unfocused data to TOF" ,
223+ InputWorkspace = outputWs ,
224+ OutputWorkspace = outputWs ,
225+ Target = "TOF" ,
226+ ),
227+ mock .call (
228+ "Converting unfocused data to dSpacing" ,
229+ InputWorkspace = outputWs ,
230+ OutputWorkspace = outputWs ,
231+ Target = "dSpacing" ,
232+ ),
233+ mock .call (
234+ f"Converting unfocused data to { units } " ,
235+ InputWorkspace = outputWs ,
236+ OutputWorkspace = outputWs ,
237+ Target = units ,
238+ ),
239+ ]
186240 )
187241 recipe .mantidSnapper .executeQueue .assert_called ()
188242 recipe .mantidSnapper .reset_mock ()
189243
190244 units = "TOF"
191- msg = f"Converting unfocused data to { units } "
192245 recipe ._prepareUnfocusedData (workspace , None , units )
193246 outputWs = (
194247 wng .run ().runNumber ("555" ).lite (True ).unit (wng .Units .TOF ).group (wng .Groups .UNFOC ).hidden (True ).build ()
195248 )
196- recipe .mantidSnapper .ConvertUnits .assert_called_once_with (
197- msg , InputWorkspace = outputWs , OutputWorkspace = outputWs , Target = units
249+ recipe .mantidSnapper .ConvertUnits .assert_has_calls (
250+ [
251+ mock .call (
252+ "Converting unfocused data to TOF" ,
253+ InputWorkspace = outputWs ,
254+ OutputWorkspace = outputWs ,
255+ Target = "TOF" ,
256+ ),
257+ mock .call (
258+ "Converting unfocused data to dSpacing" ,
259+ InputWorkspace = outputWs ,
260+ OutputWorkspace = outputWs ,
261+ Target = "dSpacing" ,
262+ ),
263+ mock .call (
264+ f"Converting unfocused data to { units } " ,
265+ InputWorkspace = outputWs ,
266+ OutputWorkspace = outputWs ,
267+ Target = units ,
268+ ),
269+ ]
198270 )
199271 recipe .mantidSnapper .executeQueue .assert_called ()
200272 recipe .mantidSnapper .reset_mock ()
@@ -228,11 +300,28 @@ def test_prepareUnfocusedData_masking(self):
228300 recipe .mantidSnapper .MaskDetectorFlags .assert_called_once_with (
229301 "Applying pixel mask to unfocused data" , MaskWorkspace = maskWs , OutputWorkspace = preOutputWs
230302 )
231- recipe .mantidSnapper .ConvertUnits .assert_called_once_with (
232- f"Converting unfocused data to { units } " ,
233- InputWorkspace = preOutputWs ,
234- OutputWorkspace = preOutputWs ,
235- Target = units ,
303+
304+ recipe .mantidSnapper .ConvertUnits .assert_has_calls (
305+ [
306+ mock .call (
307+ "Converting unfocused data to TOF" ,
308+ InputWorkspace = preOutputWs ,
309+ OutputWorkspace = preOutputWs ,
310+ Target = "TOF" ,
311+ ),
312+ mock .call (
313+ "Converting unfocused data to dSpacing" ,
314+ InputWorkspace = preOutputWs ,
315+ OutputWorkspace = preOutputWs ,
316+ Target = "dSpacing" ,
317+ ),
318+ mock .call (
319+ f"Converting unfocused data to { units } " ,
320+ InputWorkspace = preOutputWs ,
321+ OutputWorkspace = preOutputWs ,
322+ Target = units ,
323+ ),
324+ ]
236325 )
237326
238327 # Test the output add-or-replace sequence.
@@ -320,7 +409,7 @@ def test_keepUnfocusedData(self, mockMtd):
320409 result = recipe .execute ()
321410
322411 # Assertions
323- recipe ._prepareUnfocusedData .assert_called_once_with ("sample" , "mask" , "dSpacing" )
412+ recipe ._prepareUnfocusedData .assert_called_once_with ("sample" , None , "dSpacing" )
324413 # Delete the group clones (sample + norm), and the masked normalization clone.
325414 assert recipe ._deleteWorkspace .call_count == 3
326415 recipe ._deleteWorkspace .assert_called_with (recipe .normalizationWsMasked )
0 commit comments