7
7
8
8
from diffpy .labpdfproc .labpdfprocapp import get_args
9
9
from diffpy .labpdfproc .tools import (
10
- _load_wavelength_from_config_file ,
11
10
known_sources ,
12
11
load_metadata ,
13
12
load_package_info ,
14
13
load_user_info ,
15
14
load_user_metadata ,
15
+ load_wavelength_from_config_file ,
16
16
preprocessing_args ,
17
17
set_input_lists ,
18
18
set_mud ,
@@ -200,9 +200,13 @@ def test_set_output_directory_bad(user_filesystem):
200
200
@pytest .mark .parametrize (
201
201
"inputs, expected" ,
202
202
[
203
- # Test when only a home config file exists (no local config file),
204
- # expect to return args if wavelength or anode type is specified,
205
- # otherwise update args with values from the home config file.
203
+ # Test with only a home config file (no local config),
204
+ # expect to return values directly from args
205
+ # if either wavelength or anode type is specified,
206
+ # otherwise update args with values from the home config file
207
+ # (wavelength=0.3, no anode type).
208
+ # This test only checks loading behavior,
209
+ # not value validation (which is handled by `set_wavelength`).
206
210
# C1: no args, expect to update arg values from home config
207
211
(["" ], {"wavelength" : 0.3 , "anode_type" : None }),
208
212
# C2: wavelength provided, expect to return args unchanged
@@ -227,7 +231,7 @@ def test_load_wavelength_from_config_file_with_home_conf_file(
227
231
228
232
cli_inputs = ["2.5" , "data.xy" ] + inputs
229
233
actual_args = get_args (cli_inputs )
230
- actual_args = _load_wavelength_from_config_file (actual_args )
234
+ actual_args = load_wavelength_from_config_file (actual_args )
231
235
assert actual_args .wavelength == expected ["wavelength" ]
232
236
assert actual_args .anode_type == expected ["anode_type" ]
233
237
@@ -236,9 +240,13 @@ def test_load_wavelength_from_config_file_with_home_conf_file(
236
240
"inputs, expected" ,
237
241
[
238
242
# Test when a local config file exists,
239
- # expect to return args if wavelength or anode type is specified,
240
- # otherwise update args with values from the home config file.
243
+ # expect to return values directly from args
244
+ # if either wavelength or anode type is specified,
245
+ # otherwise update args with values from the local config file
246
+ # (wavelength=0.6, no anode type).
241
247
# Results should be the same whether if the home config exists.
248
+ # This test only checks loading behavior,
249
+ # not value validation (which is handled by `set_wavelength`).
242
250
# C1: no args, expect to update arg values from local config
243
251
(["" ], {"wavelength" : 0.6 , "anode_type" : None }),
244
252
# C2: wavelength provided, expect to return args unchanged
@@ -266,7 +274,7 @@ def test_load_wavelength_from_config_file_with_local_conf_file(
266
274
267
275
cli_inputs = ["2.5" , "data.xy" ] + inputs
268
276
actual_args = get_args (cli_inputs )
269
- actual_args = _load_wavelength_from_config_file (actual_args )
277
+ actual_args = load_wavelength_from_config_file (actual_args )
270
278
assert actual_args .wavelength == expected ["wavelength" ]
271
279
assert actual_args .anode_type == expected ["anode_type" ]
272
280
@@ -282,6 +290,8 @@ def test_load_wavelength_from_config_file_with_local_conf_file(
282
290
[
283
291
# Test when no config files exist,
284
292
# expect to return args without modification.
293
+ # This test only checks loading behavior,
294
+ # not value validation (which is handled by `set_wavelength`).
285
295
# C1: no args
286
296
(["" ], {"wavelength" : None , "anode_type" : None }),
287
297
# C1: wavelength provided
@@ -307,7 +317,7 @@ def test_load_wavelength_from_config_file_without_conf_files(
307
317
308
318
cli_inputs = ["2.5" , "data.xy" ] + inputs
309
319
actual_args = get_args (cli_inputs )
310
- actual_args = _load_wavelength_from_config_file (actual_args )
320
+ actual_args = load_wavelength_from_config_file (actual_args )
311
321
assert actual_args .wavelength == expected ["wavelength" ]
312
322
assert actual_args .anode_type == expected ["anode_type" ]
313
323
0 commit comments