Tests for the data_handling Module¶
Tests for the data_handling submodule.
Tests for the data_handling.request Submodule¶
Tests for the scripts.data_handling.request submodule.
These unit tests are designed to test that genes are passed to the query correctly. They do not test the API, as tests of data returned by realworld API queries are best left to integrations tests.
- tests.data_handling.test_request.test_no_no_output(tmp_path: pathlib.Path) None¶
It doesn’t output a file when the gene is not found.
- tests.data_handling.test_request.test_raises_http_error(tmp_path: pathlib.Path) None¶
It raises an HTTPError.
- tests.data_handling.test_request.test_return_none() None¶
It returns gene when the gene is not found.
- tests.data_handling.test_request.test_return_str() None¶
It returns the id when the gene is found.
- tests.data_handling.test_request.test_writes_file(tmp_path: pathlib.Path) None¶
It writes the file.
Tests for the data_handling.biomart Submodule¶
Tests for the scripts.data_handling.biomart submodule.
- tests.data_handling.test_biomart.test_raises_http_error(tmp_path: pathlib.Path) None¶
It raises an HTTPError.
- tests.data_handling.test_biomart.test_writes_file(tmp_path: pathlib.Path) None¶
It writes the file.
Tests for the data_handling.process Submodule¶
Tests for the scripts.data_handling.process submodule.
These unit tests are designed to test that the results of the query are handled correctly. They assume the data returned by the API query is formatted correctly, as tests of data returned by realworld API queries are best left to integrations tests. As such, representative data is included in the tests.data module.
- tests.data_handling.test_process.MANE¶
A minimal MANE dataset
- Type
pd.DataFrame
- tests.data_handling.test_process.test_results_columns(tmp_path: pathlib.Path) None¶
Its columns are named correctly .
- tests.data_handling.test_process.test_sorted_results(tmp_path: pathlib.Path) None¶
The results are sorted by median.
As the
merge_datafunction technically sorts on “MANE_status” as well, it would be ideal to test that sort, too. However, it it impossible to know in advance how many will have this status, so we cannot check count. Additionally, we cannot check the sort as most values are NaN, and knowing the correct order would require prior knowledge about the number of GTEx transcripts and the number with MANE status.- Parameters
tmp_path (Path) – pytest fixture for temporary path
- tests.data_handling.test_process.test_writes_file(tmp_path: pathlib.Path) None¶
It writes a file.