diff options
Diffstat (limited to 'quality_control/average.py')
-rw-r--r-- | quality_control/average.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/quality_control/average.py b/quality_control/average.py index 6ed0da7..1a7bf5f 100644 --- a/quality_control/average.py +++ b/quality_control/average.py @@ -4,4 +4,9 @@ import re from .errors import InvalidValue def valid_value(val): - return None + if re.search("^[0-9]+\.[0-9]{3}$", val): + return float(val) + raise InvalidValue( + f"Invalid value '{val}'.\n" + "Expected string representing a number with exactly three decimal " + "places.") |