aboutsummaryrefslogtreecommitdiff
path: root/tests/qc/test_cells_average.py
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 /tests/qc/test_cells_average.py
parent838049cedefc5209ff9666624b2b24eccb120fb8 (diff)
downloadgn-uploader-d511e44b1a2b0e70236831926d86a10d589e9235.tar.gz
qc: Allow whole numbers or numbers where the decimals are all zeroes
Diffstat (limited to 'tests/qc/test_cells_average.py')
-rw-r--r--tests/qc/test_cells_average.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/qc/test_cells_average.py b/tests/qc/test_cells_average.py
new file mode 100644
index 0000000..c2b382a
--- /dev/null
+++ b/tests/qc/test_cells_average.py
@@ -0,0 +1,17 @@
+import re
+from random import randint
+from hypothesis import given
+from hypothesis import strategies as st
+
+from quality_control.average import invalid_value as avg_invalid_value
+
+@given(num_str=st.from_regex(r"^[0-9]+$", fullmatch=True))
+def test_cell_average_value_pass_if_no_decimal_places(num_str):
+ """
+ GIVEN: `num_str` is a string representing a number with no decimal places,
+ e.g. 2, 39, 8420
+ WHEN: `num_str` is provided as an argument to `avg_invalid_value` function,
+ THEN: `avg_invalid_value` returns `None`
+ """
+ line, col = randint(0, 100), randint(0, 20)
+ assert avg_invalid_value(line, col, num_str) is None