aboutsummaryrefslogtreecommitdiff
path: root/quality_control
diff options
context:
space:
mode:
Diffstat (limited to 'quality_control')
-rw-r--r--quality_control/average.py7
-rw-r--r--quality_control/standard_error.py7
2 files changed, 12 insertions, 2 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.")
diff --git a/quality_control/standard_error.py b/quality_control/standard_error.py
index 9a91d1b..ae1e378 100644
--- a/quality_control/standard_error.py
+++ b/quality_control/standard_error.py
@@ -4,4 +4,9 @@ import re
from .errors import InvalidValue
def valid_value(val):
- return None
+ if re.search("^[0-9]+\.[0-9]{6,}$", val):
+ return float(val)
+ raise InvalidValue(
+ f"Invalid value '{val}'.\n"
+ "Expected string representing a number with at least six decimal "
+ "places.")