aboutsummaryrefslogtreecommitdiff
path: root/tests/qc/test_header.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qc/test_header.py')
-rw-r--r--tests/qc/test_header.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/qc/test_header.py b/tests/qc/test_header.py
index 5e54122..06647a2 100644
--- a/tests/qc/test_header.py
+++ b/tests/qc/test_header.py
@@ -11,17 +11,22 @@ from quality_control.headers import (
@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"""
- assert invalid_header(0, headers) == InvalidValue(
- 0, 0, "<TAB>".join(headers),
+ assert invalid_header("test.file", 0, headers) == InvalidValue(
+ "test.file", 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"
- assert invalid_headings(0, ("BXD1", "BXD2", "BXD3"), headings) == tuple(
- InvalidValue(0, col, heading, f"'{heading}' not a valid strain.")
- for col, heading in enumerate(headings, start=2))
+ assert invalid_headings(
+ "test.file", 0, ("BXD1", "BXD2", "BXD3"), headings) == tuple(
+ InvalidValue("test.file",
+ 0,
+ col,
+ heading,
+ f"'{heading}' not a valid strain.")
+ for col, heading in enumerate(headings, start=2))
@pytest.mark.unit_test
@pytest.mark.parametrize(
@@ -30,7 +35,7 @@ def test_invalid_headings_with_invalid_inputs(headings):
(("Individual", "AStrain", "AnotherStrain", "YetAnotherStrain"))])
def test_invalid_header_with_valid_headers(headers):
"Verify that the check for header validity works"
- assert invalid_header(0, headers) is None
+ assert invalid_header("test.file", 0, headers) is None
@pytest.mark.unit_test
@pytest.mark.parametrize(
@@ -40,7 +45,7 @@ def test_invalid_header_with_valid_headers(headers):
("AStrain", "AnotherStrain", "YetAnotherStrain"))])
def test_invalid_headings_with_valid_headings(strains, headings):
"Verify that the check for header validity works"
- assert invalid_headings(0, strains, headings) == tuple()
+ assert invalid_headings("test.file", 0, strains, headings) == tuple()
@pytest.mark.unit_test
@pytest.mark.parametrize(
@@ -50,8 +55,8 @@ def test_invalid_headings_with_valid_headings(strains, headings):
"AStrain"), {"AStrain": (2, 5)})])
def test_duplicate_headers_with_repeated_column_headings(headers, repeated):
"""Check that parsing fails if any header is duplicated"""
- assert duplicate_headings(0, headers) == tuple(
- DuplicateHeading(0, cols, head, (
+ assert duplicate_headings("test.file", 0, headers) == tuple(
+ DuplicateHeading("test.file", 0, cols, head, (
f"Heading '{head}', is repeated in columns "
f"{','.join(str(i) for i in cols)}"))
for head, cols in repeated.items())
@@ -63,4 +68,4 @@ def test_duplicate_headers_with_repeated_column_headings(headers, repeated):
(("Individual", "AStrain", "AnotherStrain", "YetAnotherStrain",))])
def test_duplicate_headers_with_unique_column_headings(headers):
"""Check that parsing fails if any header is duplicated"""
- assert duplicate_headings(0, headers) == tuple()
+ assert duplicate_headings("test.file", 0, headers) == tuple()