aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--README.org20
-rw-r--r--manifest.scm6
-rw-r--r--tests/qc/qc/test_cells.py25
-rw-r--r--tests/strategies.py8
5 files changed, 62 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 565bfbc..4f577c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-/**/*~ \ No newline at end of file
+/**/*~
+/**/*.pyc
+/.hypothesis \ No newline at end of file
diff --git a/README.org b/README.org
index 000394e..6210c08 100644
--- a/README.org
+++ b/README.org
@@ -24,3 +24,23 @@ following criteria:
- - there must be a number to the left side of the dot (e.g. 0.55555 is allowed but .55555 is not).
- check line endings to make sure they are Unix and not DOS
- check strain headers against a source of truth (see strains.csv)
+
+** Development
+
+For reproducibility, this project is developed using guix.
+
+To launch a guix shell for development, do:
+
+#+BEGIN_SRC shell
+ guix shell --container --network --manifest=manifest.scm
+#+END_SRC
+
+to get an environment that is isolated from the rest of your system.
+
+*** Tests
+
+Run tests with:
+
+#+BEGIN_SRC shell
+ pytest
+#+END_SRC
diff --git a/manifest.scm b/manifest.scm
new file mode 100644
index 0000000..c41be35
--- /dev/null
+++ b/manifest.scm
@@ -0,0 +1,6 @@
+(specifications->manifest
+ (list "python"
+ "python-mypy"
+ "python-pylint"
+ "python-pytest"
+ "python-hypothesis"))
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}"