aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-05-18 11:03:29 +0300
committerFrederick Muriuki Muriithi2022-05-18 11:03:29 +0300
commited7348ae2acefbb7806e26d5c13dfbd47ba1c9c0 (patch)
treebe294ee5dc56e361b5d584cf941de638091f315a /tests
parent582686e030b660f218cb7091aaab3cafa103465d (diff)
downloadgn-uploader-ed7348ae2acefbb7806e26d5c13dfbd47ba1c9c0.tar.gz
Parse files with new non-exception functions
Parse the files with the new functions that return error objects instead of raising exceptions
Diffstat (limited to 'tests')
-rw-r--r--tests/qc/test_error_collection.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/qc/test_error_collection.py b/tests/qc/test_error_collection.py
index 3a26d9c..466f455 100644
--- a/tests/qc/test_error_collection.py
+++ b/tests/qc/test_error_collection.py
@@ -1,6 +1,7 @@
import pytest
from quality_control.parsing import take, FileType, parse_errors
+from quality_control.parsing import collect_errors
@pytest.mark.slow
@pytest.mark.parametrize(
@@ -37,3 +38,21 @@ def test_take(sample, num, expected):
taken = take(sample, num)
assert len(taken) <= num
assert taken == expected
+
+
+## ==================================================
+
+@pytest.mark.slow
+@pytest.mark.parametrize(
+ "filepath,filetype,count",
+ (("tests/test_data/average_crlf.tsv", FileType.AVERAGE, 10),
+ ("tests/test_data/average_error_at_end_200MB.tsv", FileType.AVERAGE,
+ 20),
+ ("tests/test_data/average.tsv", FileType.AVERAGE, 5),
+ ("tests/test_data/standarderror_1_error_at_end.tsv",
+ FileType.STANDARD_ERROR, 13),
+ ("tests/test_data/standarderror.tsv", FileType.STANDARD_ERROR, 9),
+ ("tests/test_data/duplicated_headers_no_data_errors.tsv",
+ FileType.AVERAGE, 10)))
+def test_collect_errors(filepath, filetype, strains, count):
+ assert len(collect_errors(filepath, filetype, strains, count)) <= count