aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-04-11 12:38:52 +0300
committerFrederick Muriuki Muriithi2022-04-11 12:38:52 +0300
commita126edd7a9f2a72bf744a34c57aa9cb23568ba29 (patch)
treeebfd5e30fa9f850454f81e3ee839c67cf46013fd /tests
parent7ea15269cb85c32e55ebcc6381de77810d898927 (diff)
downloadgn-uploader-a126edd7a9f2a72bf744a34c57aa9cb23568ba29.tar.gz
Set up initial, failing tests for cell values
Diffstat (limited to 'tests')
-rw-r--r--tests/qc/qc/test_cells.py25
-rw-r--r--tests/strategies.py8
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/qc/qc/test_cells.py b/tests/qc/qc/test_cells.py
new file mode 100644
index 0000000..8f1e9ea
--- /dev/null
+++ b/tests/qc/qc/test_cells.py
@@ -0,0 +1,25 @@
+"""Test that values in cells within a line fulfill the required criteria"""
+
+from hypothesis import given
+from hypothesis import strategies as st
+
+@given(num_str=st.from_regex("^(?!([0-9]+\.([0-9]{3}|[0-9]{6,}))).*", fullmatch=True))
+def test_cell_value_errors_with_invalid_inputs(num_str):
+ print(f"NUMBER STRING: {num_str}")
+ assert False, "Not implemented"
+
+@given(num_str=st.from_regex("[0-9]+\.([0-9]{1,2}|[0-9]{4,})", fullmatch=True))
+def test_cell_average_value_errors_if_not_three_decimal_places(num_str):
+ assert False, "Not implemented"
+
+@given(num_str=st.from_regex("[0-9]+\.[0-9]{3}", fullmatch=True))
+def test_cell_average_value_pass_if_three_decimal_places(num_str):
+ assert False, "Not implemented"
+
+@given(num_str=st.from_regex("[0-9]+\.([0-9]{0,5})", fullmatch=True))
+def test_cell_standard_error_value_errors_if_less_than_six_decimal_places(num_str):
+ assert False, "Not implemented"
+
+@given(num_str=st.from_regex("[0-9]+\.[0-9]{6,}", fullmatch=True))
+def test_cell_standard_error_value_pass_if_six_or_more_decimal_places(num_str):
+ assert False, "Not implemented"
diff --git a/tests/strategies.py b/tests/strategies.py
new file mode 100644
index 0000000..ccda362
--- /dev/null
+++ b/tests/strategies.py
@@ -0,0 +1,8 @@
+"""Module holding custom data generation strategies"""
+
+from hypothesis.strategies import characters, composite
+
+@composite
+def average_numbers_string(draw):
+ num = draw(floats(allow_nan=False, allow_infinity=False,))
+ return f"{num:.3f}"