diff options
author | Frederick Muriuki Muriithi | 2022-04-13 10:09:02 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-04-13 10:09:02 +0300 |
commit | bb8a92b36f85f6f3b2c6cd9ed6bbebd03ecf127c (patch) | |
tree | 2a0f89e8c8f431fff9674ec6c730bdbdcfe9c430 | |
parent | 0cc8fd5fb2a026662dc2bd12f6bad9f68e5da5b0 (diff) | |
download | gn-uploader-bb8a92b36f85f6f3b2c6cd9ed6bbebd03ecf127c.tar.gz |
Add tests outline for file parsing
Add dummy failing tests and a stub for the parsing of the files
-rw-r--r-- | quality_control/parsing.py | 12 | ||||
-rw-r--r-- | tests/qc/test_parsing.py | 43 |
2 files changed, 55 insertions, 0 deletions
diff --git a/quality_control/parsing.py b/quality_control/parsing.py new file mode 100644 index 0000000..52124f9 --- /dev/null +++ b/quality_control/parsing.py @@ -0,0 +1,12 @@ +from enum import Enum + +import quality_control.average as avg +import quality_control.standard_error as se +from quality_control.errors import InvalidCellValue, InvalidHeaderValue + +class FileType(Enum): + AVERAGE = 1 + STANDARD_ERROR = 2 + +def parse_file(filepath: str, filetype: FileType): + pass diff --git a/tests/qc/test_parsing.py b/tests/qc/test_parsing.py new file mode 100644 index 0000000..5fe5a3d --- /dev/null +++ b/tests/qc/test_parsing.py @@ -0,0 +1,43 @@ +import pytest + +from quality_control.parsing import FileType, parse_file + + +@pytest.mark.parametrize( + "filepath,filetype", + (("tests/test_data/average_crlf.tsv", FileType.STANDARD_ERROR), + ("tests/test_data/average_error_at_end_200MB.tsv", + FileType.STANDARD_ERROR), + ("tests/test_data/average.tsv", FileType.STANDARD_ERROR), + ("tests/test_data/standarderror_1_error_at_end.tsv", FileType.AVERAGE), + ("tests/test_data/standarderror.tsv", FileType.AVERAGE), + ("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" + +@pytest.mark.parametrize( + "filepath,filetype", + (("tests/test_data/average_crlf.tsv", FileType.AVERAGE), + ("tests/test_data/average.tsv", FileType.AVERAGE), + ("tests/test_data/standarderror.tsv", FileType.STANDARD_ERROR), + ("tests/test_data/we_found_no_errors_in_your_file.tsv", FileType.AVERAGE))) +def test_parse_file_passes_with_valid_files(filepath, filetype): + assert False, "Not Implemented" + +@pytest.mark.parametrize( + "filepath,filetype", + (("tests/test_data/average_large.tsv", FileType.AVERAGE), + ("tests/test_data/average.tsv", FileType.AVERAGE), + ("tests/test_data/standarderror.tsv", FileType.STANDARD_ERROR), + ("tests/test_data/we_found_no_errors_in_your_file.tsv", FileType.AVERAGE))) +def test_parse_file_works_with_large_files(filepath, filetype): + assert False, "Not Implemented" + + +@pytest.mark.parametrize( + "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" |