Skip to content

Commit d6c352e

Browse files
committed
strengthen the ValueError message
1 parent 6edcd83 commit d6c352e

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

src/diffpy/labpdfproc/tools.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,20 @@ def load_wavelength_from_config_file(args):
246246
return normalize_wavelength(args)
247247
else:
248248
raise ValueError(
249-
"No configuration file was found containing information "
250-
"about the wavelength or anode type. \n"
251-
"You can add the wavelength or anode type "
252-
"to a configuration file on the current computer "
253-
"and it will be automatically associated with "
254-
"subsequent diffpy data by default. \n"
255-
"You will only have to do that once. \n"
256-
"For more information, please refer to www.diffpy.org/"
257-
"diffpy.labpdfproc/examples/toolsexample.html"
249+
"\nThe wavelength was not specified and no "
250+
"configuration file 'diffpyconfig.json' containing "
251+
"the wavelength or X-ray source was found in either the "
252+
"local or home directories. Either specify the wavelength "
253+
"or source using the -w/--wavelength option or "
254+
"create a configuration file.\n\n"
255+
"You can add the wavelength or anode type to a "
256+
"configuration file on this computer. Once created, it "
257+
"will be automatically used for subsequent diffpy data "
258+
"by default, and you will only need to do this once.\n\n"
259+
"For detailed instructions on creating the configuration "
260+
"file, please refer to:\n"
261+
"https://www.diffpy.org/diffpy.labpdfproc/examples/"
262+
"toolsexample.html"
258263
)
259264

260265

tests/test_tools.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,20 @@ def test_load_wavelength_from_config_file_without_conf_files_bad(
360360
actual_args = get_args_cli(cli_inputs)
361361

362362
msg = re.escape(
363-
"No configuration file was found containing information "
364-
"about the wavelength or anode type. \n"
365-
"You can add the wavelength or anode type "
366-
"to a configuration file on the current computer "
367-
"and it will be automatically associated with "
368-
"subsequent diffpy data by default. \n"
369-
"You will only have to do that once. \n"
370-
"For more information, please refer to www.diffpy.org/"
371-
"diffpy.labpdfproc/examples/toolsexample.html"
363+
"\nThe wavelength was not specified and no "
364+
"configuration file 'diffpyconfig.json' containing "
365+
"the wavelength or X-ray source was found in either the "
366+
"local or home directories. Either specify the wavelength "
367+
"or source using the -w/--wavelength option or "
368+
"create a configuration file.\n\n"
369+
"You can add the wavelength or anode type to a "
370+
"configuration file on this computer. Once created, it "
371+
"will be automatically used for subsequent diffpy data "
372+
"by default, and you will only need to do this once.\n\n"
373+
"For detailed instructions on creating the configuration "
374+
"file, please refer to:\n"
375+
"https://www.diffpy.org/diffpy.labpdfproc/examples/"
376+
"toolsexample.html"
372377
)
373378
with pytest.raises(ValueError, match=msg):
374379
load_wavelength_from_config_file(actual_args)

0 commit comments

Comments
 (0)