@@ -279,7 +279,36 @@ def test_d_to_tth():
279279 assert np .allclose (actual_tth , expected_tth )
280280
281281
282- #def test_set_all_arrays():
282+ params_array = [
283+ (["q" , "on_q" , [4.58087 , 8.84956 ], [1 , 2 ]]),
284+ (["tth" , "on_tth" , [30 , 60 ], [1 , 2 ]]),
285+ (["d" , "on_d" , [1.37161 , 0.71 ], [1 , 2 ]]),
286+ ]
287+
288+
289+ @pytest .mark .parametrize ("inputs" , params_array )
290+ def test_set_all_arrays (inputs ):
291+ input_xtype , on_xtype , xarray , yarray = inputs
292+ expected_values = {
293+ "on_tth" : [np .array ([30 , 60 ]), np .array ([1 , 2 ])],
294+ "on_q" : [np .array ([4.58087 , 8.84956 ]), np .array ([1 , 2 ])],
295+ "on_d" : [np .array ([1.37161 , 0.71 ]), np .array ([1 , 2 ])],
296+ "tthmin" : 30 ,
297+ "tthmax" : 60 ,
298+ "qmin" : 4.58087 ,
299+ "qmax" : 8.84956 ,
300+ "dmin" : 1.37161 ,
301+ "dmax" : 0.71 ,
302+ }
303+
304+ actual = Diffraction_object (wavelength = 0.71 )
305+ setattr (actual , "input_xtype" , input_xtype )
306+ setattr (actual , on_xtype , [xarray , yarray ])
307+ actual .set_all_arrays ()
308+ for attr , expected in expected_values .items ():
309+ actual_value = getattr (actual , attr )
310+ assert np .allclose (actual_value , expected )
311+
283312
284313def test_dump (tmp_path , mocker ):
285314 x , y = np .linspace (0 , 5 , 6 ), np .linspace (0 , 5 , 6 )
0 commit comments