@@ -32,7 +32,6 @@ def test_q_to_tth(wavelength, q, expected_tth, wavelength_warning_msg):
3232 actual_tth = q_to_tth (q , wavelength )
3333 else :
3434 actual_tth = q_to_tth (q , wavelength )
35-
3635 assert np .allclose (expected_tth , actual_tth )
3736
3837
@@ -205,14 +204,14 @@ def test_tth_to_d(wavelength, tth, expected_d, divide_by_zero_warning_expected,
205204@pytest .mark .parametrize (
206205 "wavelength, tth, expected_error_type, expected_error_msg" ,
207206 [
208- # C1: User specified an invalid tth value of > 180 degrees (without wavelength)
207+ # C1: Invalid tth value of > 180 degrees, no wavelength, expect two theta ValueError
209208 (
210209 None ,
211210 np .array ([0 , 30 , 60 , 90 , 120 , 181 ]),
212211 ValueError ,
213212 "Two theta exceeds 180 degrees. Please check the input values for errors." ,
214213 ),
215- # C2: User specified an invalid tth value of > 180 degrees ( with wavelength)
214+ # C2: Invalid tth value of > 180 degrees with wavelength, expect two theta ValueError
216215 (
217216 4 * np .pi ,
218217 np .array ([0 , 30 , 60 , 90 , 120 , 181 ]),
@@ -229,13 +228,13 @@ def test_tth_to_d_invalid(wavelength, tth, expected_error_type, expected_error_m
229228@pytest .mark .parametrize (
230229 "wavelength, d, expected_tth, divide_by_zero_warning_expected" ,
231230 [
232- # C1: Empty d values, no wavelength, return empty arrays
231+ # C1: Empty d values, no wavelength, expect empty tth values
233232 (None , np .empty ((0 )), np .empty ((0 )), False ),
234- # C2: Empty d values, wavelength specified, return empty arrays
233+ # C2: Empty d values with wavelength, expect empty tth values
235234 (4 * np .pi , np .empty ((0 )), np .empty (0 ), False ),
236- # C3: User specified valid d values, no wavelength, return empty arrays
235+ # C3: Valid d values, no wavelength, expect valid and non- empty tth values
237236 (None , np .array ([1 , 0.8 , 0.6 , 0.4 , 0.2 , 0 ]), np .array ([0 , 1 , 2 , 3 , 4 , 5 ]), True ),
238- # C4: User specified valid d values ( with wavelength)
237+ # C4: Valid d values with wavelength, expect valid and non-empty thh values
239238 (
240239 4 * np .pi ,
241240 np .array ([4 * np .pi , 4 / np .sqrt (2 ) * np .pi , 4 / np .sqrt (3 ) * np .pi ]),
@@ -254,16 +253,15 @@ def test_d_to_tth(wavelength, d, expected_tth, divide_by_zero_warning_expected,
254253 actual_tth = d_to_tth (d , wavelength )
255254 else :
256255 actual_tth = d_to_tth (d , wavelength )
257-
258256 assert np .allclose (actual_tth , expected_tth )
259257
260258
261259@pytest .mark .parametrize (
262260 "wavelength, d, expected_error_type" ,
263261 [
264- # C1: User specified invalid d values that result in tth > 180 degrees
262+ # C1: Invalid d values that result in tth > 180 degrees, expect invalid q, d, or wavelength ValueError
265263 (4 * np .pi , np .array ([1.2 , 1 , 0.8 , 0.6 , 0.4 , 0.2 ]), ValueError ),
266- # C2: User specified a wrong wavelength that result in tth > 180 degrees
264+ # C2: Wrong wavelength that result in tth > 180 degreesm, expect invalid q, d, or wavelength ValueError
267265 (100 , np .array ([1.2 , 1 , 0.8 , 0.6 , 0.4 , 0.2 ]), ValueError ),
268266 ],
269267)
0 commit comments