File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
import argparse
2
+ import re
2
3
3
4
import pytest
4
5
@@ -33,5 +34,5 @@ def test_set_wavelength(inputs, expected):
33
34
@pytest .mark .parametrize ("inputs, msg" , params3 )
34
35
def test_set_wavelength_bad (inputs , msg ):
35
36
actual_args = argparse .Namespace (wavelength = inputs [0 ], anode_type = inputs [1 ])
36
- with pytest .raises (ValueError , match = msg [0 ]):
37
+ with pytest .raises (ValueError , match = re . escape ( msg [0 ]) ):
37
38
actual_args .wavelength = set_wavelength (actual_args )
Original file line number Diff line number Diff line change @@ -20,12 +20,12 @@ def set_wavelength(args):
20
20
21
21
"""
22
22
if args .wavelength is not None and args .wavelength <= 0 :
23
- raise ValueError ("Please rerun the program specifying a positive float number." )
23
+ raise ValueError (
24
+ "No valid wavelength. Please rerun specifying a known anode_type or a positive wavelength"
25
+ )
24
26
if not args .wavelength and args .anode_type and args .anode_type not in WAVELENGTHS :
25
27
raise ValueError (
26
- f"Invalid anode type { args .anode_type } . "
27
- f"Please rerun the program to either specify a wavelength as a positive float number "
28
- f"or specify anode_type as one of { known_sources } ."
28
+ f"Anode type not recognized. please rerun specifying an anode_type from { * known_sources , } "
29
29
)
30
30
31
31
if args .wavelength :
You can’t perform that action at this time.
0 commit comments