From ed7348ae2acefbb7806e26d5c13dfbd47ba1c9c0 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 18 May 2022 11:03:29 +0300 Subject: Parse files with new non-exception functions Parse the files with the new functions that return error objects instead of raising exceptions --- tests/qc/test_error_collection.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3