aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-02 09:30:57 +0300
committerFrederick Muriuki Muriithi2024-01-02 09:30:57 +0300
commitee0cf7de526849f228c73b744bf66d22c30b34de (patch)
tree97b2758adccae5bb3bc8e688d7d3b845d1a0ddb8
parentb3b9ba3b5b4e516d6220668155f9b5c57a51eb7d (diff)
downloadgn-uploader-ee0cf7de526849f228c73b744bf66d22c30b34de.tar.gz
Mark tests as unit tests.
-rw-r--r--tests/qc/test_cells.py4
-rw-r--r--tests/qc/test_error_collection.py3
-rw-r--r--tests/qc/test_header.py6
3 files changed, 12 insertions, 1 deletions
diff --git a/tests/qc/test_cells.py b/tests/qc/test_cells.py
index f5411fe..51e8bcf 100644
--- a/tests/qc/test_cells.py
+++ b/tests/qc/test_cells.py
@@ -10,6 +10,7 @@ from quality_control.errors import InvalidValue
from quality_control.average import invalid_value as avg_invalid_value
from quality_control.standard_error import invalid_value as se_invalid_value
+@pytest.mark.unit_test
@given(num_str=st.from_regex(
r"^(?!([0-9]+\.[0-9]{1,}|0+)).*", fullmatch=True))
def test_cell_value_errors_with_invalid_inputs2(num_str):
@@ -48,6 +49,7 @@ def test_cell_average_value_errors_if_not_three_decimal_places2(num_str):
f"Invalid value '{num_str}'. Expected string representing a number "
"with exactly three decimal places."))
+@pytest.mark.unit_test
@given(num_str=st.from_regex(r"^[0-9]+\.[0-9]{1,}$", fullmatch=True))
def test_cell_average_value_pass_if_three_decimal_places(num_str):
"""
@@ -77,7 +79,7 @@ def test_cell_standard_error_value_errors_if_less_than_six_decimal_places2(num_s
f"Invalid value '{num_str}'. Expected string representing a number "
"with at least six decimal places."))
-
+@pytest.mark.unit_test
@given(num_str=st.from_regex(r"^[0-9]+\.[0-9]{1,}$", fullmatch=True))
def test_cell_standard_error_value_pass_if_six_or_more_decimal_places(num_str):
"""
diff --git a/tests/qc/test_error_collection.py b/tests/qc/test_error_collection.py
index ee1e6c2..25f5d01 100644
--- a/tests/qc/test_error_collection.py
+++ b/tests/qc/test_error_collection.py
@@ -6,6 +6,7 @@ from quality_control.parsing import take, FileType, collect_errors
from quality_control.errors import (
InvalidValue, DuplicateHeading, InconsistentColumns)
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"sample,num,expected",
((range(0,25), 5, [0, 1, 2, 3, 4]),
@@ -18,6 +19,7 @@ def test_take(sample, num, expected):
assert taken == expected
@pytest.mark.slow
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"filepath,filetype,count",
(("tests/test_data/average_crlf.tsv", FileType.AVERAGE, 10),
@@ -36,6 +38,7 @@ def test_collect_errors(filepath, filetype, strains, count):
return isinstance(item, (InvalidValue, DuplicateHeading))
assert all(__valid_instance(error) for error in results)
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"filepath,filetype,expected",
(("tests/test_data/average_inconsistent_columns.tsv", FileType.AVERAGE,
diff --git a/tests/qc/test_header.py b/tests/qc/test_header.py
index 2557e85..5e54122 100644
--- a/tests/qc/test_header.py
+++ b/tests/qc/test_header.py
@@ -7,6 +7,7 @@ from quality_control.errors import InvalidValue, DuplicateHeading
from quality_control.headers import (
invalid_header, invalid_headings, duplicate_headings)
+@pytest.mark.unit_test
@given(headers=st.lists(st.text(max_size=10), max_size=1))
def test_invalid_header_with_list_of_one_value(headers):
"""Test `invalid_header` with invalid header row"""
@@ -14,6 +15,7 @@ def test_invalid_header_with_list_of_one_value(headers):
0, 0, "<TAB>".join(headers),
"The header MUST contain at least 2 columns")
+@pytest.mark.unit_test
@given(headings=st.lists(st.text(min_size=2, max_size=10), min_size=2))
def test_invalid_headings_with_invalid_inputs(headings):
"Verify that the check for header validity works"
@@ -21,6 +23,7 @@ def test_invalid_headings_with_invalid_inputs(headings):
InvalidValue(0, col, heading, f"'{heading}' not a valid strain.")
for col, heading in enumerate(headings, start=2))
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"headers", [
(("ProbeSet", "BXD3", "BXD1")),
@@ -29,6 +32,7 @@ def test_invalid_header_with_valid_headers(headers):
"Verify that the check for header validity works"
assert invalid_header(0, headers) is None
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"strains,headings", [
(("BXD1", "BXD2", "BXD3"), ("BXD3", "BXD1")),
@@ -38,6 +42,7 @@ def test_invalid_headings_with_valid_headings(strains, headings):
"Verify that the check for header validity works"
assert invalid_headings(0, strains, headings) == tuple()
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"headers,repeated", [
(("ProbeSet", "BXD3", "BXD1", "BXD1"), {"BXD1": (3, 4)}),
@@ -51,6 +56,7 @@ def test_duplicate_headers_with_repeated_column_headings(headers, repeated):
f"{','.join(str(i) for i in cols)}"))
for head, cols in repeated.items())
+@pytest.mark.unit_test
@pytest.mark.parametrize(
"headers", [
(("ProbeSet", "BXD3", "BXD1")),