aboutsummaryrefslogtreecommitdiff
path: root/tests/qc/test_parsing.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-04-13 12:03:08 +0300
committerFrederick Muriuki Muriithi2022-04-13 12:03:08 +0300
commit1cc86cb4b71fe29b40115813836ca1277c1df859 (patch)
treed511c13a53f5e882e29129bbe190afecc6caa0dc /tests/qc/test_parsing.py
parentbb8a92b36f85f6f3b2c6cd9ed6bbebd03ecf127c (diff)
downloadgn-uploader-1cc86cb4b71fe29b40115813836ca1277c1df859.tar.gz
Implement test for parsing that fails
* Improve tests that ensure parsing fails in case the file has errors * Add strains.csv file * Implement minimum viable functionality that passes the implemented tests
Diffstat (limited to 'tests/qc/test_parsing.py')
-rw-r--r--tests/qc/test_parsing.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/qc/test_parsing.py b/tests/qc/test_parsing.py
index 5fe5a3d..14cfbde 100644
--- a/tests/qc/test_parsing.py
+++ b/tests/qc/test_parsing.py
@@ -1,8 +1,8 @@
import pytest
+from quality_control.errors import ParseError
from quality_control.parsing import FileType, parse_file
-
@pytest.mark.parametrize(
"filepath,filetype",
(("tests/test_data/average_crlf.tsv", FileType.STANDARD_ERROR),
@@ -14,7 +14,9 @@ from quality_control.parsing import FileType, parse_file
("tests/test_data/we_found_no_errors_in_your_file.tsv",
FileType.STANDARD_ERROR),))
def test_parse_file_fails_with_wrong_filetype_declaration(filepath, filetype):
- assert False, "Not Implemented"
+ with pytest.raises(ParseError):
+ for line in parse_file(filepath, filetype, "strains.csv"):
+ pass
@pytest.mark.parametrize(
"filepath,filetype",
@@ -40,4 +42,6 @@ def test_parse_file_works_with_large_files(filepath, filetype):
(("tests/test_data/average_error_at_end_200MB.tsv", FileType.AVERAGE),
("tests/test_data/standarderror_1_error_at_end.tsv", FileType.STANDARD_ERROR)))
def test_parse_file_raises_exception_on_error_in_file(filepath, filetype):
- assert False, "Not Implemented"
+ with pytest.raises(ParseError):
+ for line in parse_file(filepath, filetype, "strains.csv"):
+ pass