@@ -214,7 +214,7 @@ def test_set_output_directory_bad(user_filesystem):
214214 # This test only checks loading behavior,
215215 # not value validation (which is handled by `set_wavelength`).
216216 # C1: no args, expect to update arg values from home config
217- (["" ], {"wavelength" : 0.3 , "anode_type" : None }),
217+ ([], {"wavelength" : 0.3 , "anode_type" : None }),
218218 # C2: wavelength provided, expect to return args unchanged
219219 (["--wavelength" , "0.25" ], {"wavelength" : 0.25 , "anode_type" : None }),
220220 # C3: anode type provided, expect to return args unchanged
@@ -235,7 +235,7 @@ def test_load_wavelength_from_config_file_with_home_conf_file(
235235 mocker .patch ("pathlib.Path.home" , lambda _ : home_dir )
236236 os .chdir (cwd )
237237
238- cli_inputs = ["2.5 " , "data.xy " ] + inputs
238+ cli_inputs = ["data.xy " , "--mud" , "2.5 " ] + inputs
239239 actual_args = get_args (cli_inputs )
240240 actual_args = load_wavelength_from_config_file (actual_args )
241241 assert actual_args .wavelength == expected ["wavelength" ]
@@ -254,7 +254,7 @@ def test_load_wavelength_from_config_file_with_home_conf_file(
254254 # This test only checks loading behavior,
255255 # not value validation (which is handled by `set_wavelength`).
256256 # C1: no args, expect to update arg values from local config
257- (["" ], {"wavelength" : 0.6 , "anode_type" : None }),
257+ ([], {"wavelength" : 0.6 , "anode_type" : None }),
258258 # C2: wavelength provided, expect to return args unchanged
259259 (["--wavelength" , "0.25" ], {"wavelength" : 0.25 , "anode_type" : None }),
260260 # C3: anode type provided, expect to return args unchanged
@@ -278,7 +278,7 @@ def test_load_wavelength_from_config_file_with_local_conf_file(
278278 with open (cwd / "diffpyconfig.json" , "w" ) as f :
279279 json .dump (local_config_data , f )
280280
281- cli_inputs = ["2.5 " , "data.xy " ] + inputs
281+ cli_inputs = ["data.xy " , "--mud" , "2.5 " ] + inputs
282282 actual_args = get_args (cli_inputs )
283283 actual_args = load_wavelength_from_config_file (actual_args )
284284 assert actual_args .wavelength == expected ["wavelength" ]
@@ -299,7 +299,7 @@ def test_load_wavelength_from_config_file_with_local_conf_file(
299299 # This test only checks loading behavior,
300300 # not value validation (which is handled by `set_wavelength`).
301301 # C1: no args
302- (["" ], {"wavelength" : None , "anode_type" : None }),
302+ ([], {"wavelength" : None , "anode_type" : None }),
303303 # C1: wavelength provided
304304 (["--wavelength" , "0.25" ], {"wavelength" : 0.25 , "anode_type" : None }),
305305 # C2: anode type provided
@@ -321,7 +321,7 @@ def test_load_wavelength_from_config_file_without_conf_files(
321321 confile = home_dir / "diffpyconfig.json"
322322 os .remove (confile )
323323
324- cli_inputs = ["2.5 " , "data.xy " ] + inputs
324+ cli_inputs = ["data.xy " , "--mud" , "2.5 " ] + inputs
325325 actual_args = get_args (cli_inputs )
326326 actual_args = load_wavelength_from_config_file (actual_args )
327327 assert actual_args .wavelength == expected ["wavelength" ]
@@ -406,13 +406,13 @@ def test_set_wavelength(inputs, expected):
406406 ( # C3: invalid anode type
407407 # expect error asking to specify a valid anode type
408408 ["--anode-type" , "invalid" ],
409- f"Anode type not recognized. "
409+ f"Anode type 'invalid' not recognized. "
410410 f"Please rerun specifying an anode_type from { * known_sources , } ." ,
411411 ),
412412 ( # C4: invalid wavelength
413413 # expect error asking to specify a valid wavelength or anode type
414- ["--wavelength" , "0 " ],
415- "No valid wavelength . "
414+ ["--wavelength" , "-0.2 " ],
415+ "Wavelength = -0.2 is not valid . "
416416 "Please rerun specifying a known anode_type "
417417 "or a positive wavelength." ,
418418 ),
@@ -421,6 +421,7 @@ def test_set_wavelength(inputs, expected):
421421def test_set_wavelength_bad (inputs , expected_error_msg ):
422422 cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
423423 actual_args = get_args (cli_inputs )
424+ print (actual_args .wavelength )
424425 with pytest .raises (ValueError , match = re .escape (expected_error_msg )):
425426 actual_args = set_wavelength (actual_args )
426427
0 commit comments