@@ -165,9 +165,9 @@ def test_diffraction_objects_equality(
165165 # 2. "2theta" provided, expect tth
166166 ("tth" , np .array ([30 , 60 ])),
167167 ("2theta" , np .array ([30 , 60 ])),
168- # C2: "q" provided, expect q
168+ # C2: "q" provided, expect q converted from tth
169169 ("q" , np .array ([0.51764 , 1 ])),
170- # C3: "d" provided, expect d
170+ # C3: "d" provided, expect d converted from tth
171171 ("d" , np .array ([12.13818 , 6.28319 ])),
172172 ],
173173)
@@ -192,7 +192,7 @@ def test_init_invalid_xtype():
192192@pytest .mark .parametrize (
193193 "org_do_args, target_do_args, scale_inputs, expected" ,
194194 [
195- # Test that scale_to() scales to the correct values
195+ # Test whether scale_to() scales to the expected values
196196 # C1: Same x-array and y-array, check offset
197197 (
198198 {
@@ -297,7 +297,8 @@ def test_scale_to(org_do_args, target_do_args, scale_inputs, expected):
297297@pytest .mark .parametrize (
298298 "org_do_args, target_do_args, scale_inputs" ,
299299 [
300- # C1: User did not specify anything
300+ # Test expected errors produced from scale_to() with invalid inputs
301+ # C1: none of q, tth, d, provided, expect ValueError
301302 (
302303 {
303304 "xarray" : np .array ([0.1 , 0.2 , 0.3 ]),
@@ -318,7 +319,7 @@ def test_scale_to(org_do_args, target_do_args, scale_inputs, expected):
318319 "offset" : 0 ,
319320 },
320321 ),
321- # C2: User specified more than one of q, tth, and d
322+ # C2: more than one of either q, tth, d, provided, expect ValueError
322323 (
323324 {
324325 "xarray" : np .array ([10 , 25 , 30.1 , 40.2 , 61 , 120 , 140 ]),
@@ -359,12 +360,13 @@ def test_scale_to_bad(org_do_args, target_do_args, scale_inputs):
359360@pytest .mark .parametrize (
360361 "wavelength, xarray, yarray, xtype_1, xtype_2, value, expected_index" ,
361362 [
362- # U1: Exact match
363+ # Test whether get_array_index() returns the expected index
364+ # C1: Exact match
363365 (4 * np .pi , np .array ([30.005 , 60 ]), np .array ([1 , 2 ]), "tth" , "tth" , 30.005 , [0 ]),
364- # U2 : Target value lies in the array, returns the (first) closest index
366+ # C2 : Target value lies in the array, returns the (first) closest index
365367 (4 * np .pi , np .array ([30 , 60 ]), np .array ([1 , 2 ]), "tth" , "tth" , 45 , [0 ]),
366368 (4 * np .pi , np .array ([30 , 60 ]), np .array ([1 , 2 ]), "tth" , "q" , 0.25 , [0 ]),
367- # U3 : Target value out of the range, returns the closest index
369+ # C3 : Target value out of the range, returns the closest index
368370 (4 * np .pi , np .array ([0.25 , 0.5 , 0.71 ]), np .array ([1 , 2 , 3 ]), "q" , "q" , 0.1 , [0 ]),
369371 (4 * np .pi , np .array ([30 , 60 ]), np .array ([1 , 2 ]), "tth" , "tth" , 63 , [1 ]),
370372 ],
0 commit comments