Skip to content

Commit cc19c07

Browse files
committed
tests for error messages
1 parent 0e2ab8c commit cc19c07

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/diffpy/labpdfproc/tests/test_tools.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from diffpy.labpdfproc.tools import set_wavelength
5+
from diffpy.labpdfproc.tools import WAVELENGTHS, set_wavelength
66

77
params2 = [
88
([None, None], [0.71]),
@@ -21,14 +21,17 @@ def test_set_wavelength(inputs, expected):
2121

2222

2323
params3 = [
24-
([None, "invalid"]),
25-
([0, None]),
26-
([-1, "Mo"]),
24+
(
25+
[None, "invalid"],
26+
[f"Anode type not recognized. please rerun specifying an anode_type from {*WAVELENGTHS, }"],
27+
),
28+
([0, None], ["No valid wavelength. Please rerun specifying a known anode_type or a positive wavelength"]),
29+
([-1, "Mo"], ["No valid wavelength. Please rerun specifying a known anode_type or a positive wavelength"]),
2730
]
2831

2932

3033
@pytest.mark.parametrize("inputs", params3)
3134
def test_set_wavelength_bad(inputs):
35+
actual_args = argparse.Namespace(wavelength=inputs[0], anode_type=inputs[1])
3236
with pytest.raises(ValueError):
33-
actual_args = argparse.Namespace(wavelength=inputs[0], anode_type=inputs[1])
3437
actual_args.wavelength = set_wavelength(actual_args)

0 commit comments

Comments
 (0)