aboutsummaryrefslogtreecommitdiff
path: root/quality_control
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-11-16 04:16:01 +0300
committerFrederick Muriuki Muriithi2022-11-16 04:16:01 +0300
commitd511e44b1a2b0e70236831926d86a10d589e9235 (patch)
tree7e5ca3dbe0eb18c3dd2cb19b4fbbb1278cce9be3 /quality_control
parent838049cedefc5209ff9666624b2b24eccb120fb8 (diff)
downloadgn-uploader-d511e44b1a2b0e70236831926d86a10d589e9235.tar.gz
qc: Allow whole numbers or numbers where the decimals are all zeroes
Diffstat (limited to 'quality_control')
-rw-r--r--quality_control/average.py4
-rw-r--r--quality_control/standard_error.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/quality_control/average.py b/quality_control/average.py
index 2b098db..ad732d0 100644
--- a/quality_control/average.py
+++ b/quality_control/average.py
@@ -9,8 +9,8 @@ def invalid_value(line_number: int, column_number: int, val: str) -> Union[
"""Return an `InvalidValue` object if `val` is not a valid "averages"
value."""
return cell_error(
- r"^[0-9]+\.[0-9]{3}$", val, line=line_number, column=column_number,
- value=val, message=(
+ r"^([0-9]+\.[0-9]{3}|[0-9]+\.?0*)$", val, line=line_number,
+ column=column_number, value=val, message=(
f"Invalid value '{val}'. "
"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 7e059ad..90beb8a 100644
--- a/quality_control/standard_error.py
+++ b/quality_control/standard_error.py
@@ -13,8 +13,8 @@ def invalid_value(
`None`.
"""
return cell_error(
- r"^[0-9]+\.[0-9]{6,}$", val, line=line_number, column=column_number,
- value=val, message=(
+ r"^([0-9]+\.[0-9]{6,}|[0-9]+\.?0*)$", val, line=line_number,
+ column=column_number, value=val, message=(
f"Invalid value '{val}'. "
"Expected string representing a number with at least six "
"decimal places."))