diff options
author | Munyoki Kilyungi | 2022-09-07 11:18:06 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-09-08 14:26:19 +0300 |
commit | f879f82ad0393a770ed50043c70ee1dd4a12daaa (patch) | |
tree | cb6744e0c00ffe0715e9149be0b11e9e2407e872 /wqflask | |
parent | a0aa7bbf473506ff513c7a5557654f2bf05b0df9 (diff) | |
download | genenetwork2-f879f82ad0393a770ed50043c70ee1dd4a12daaa.tar.gz |
Rewrite "test_tissue_corr_computation" as a pytest
* wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py
(TestCorrelationFunctions): Convert this unittest class to ...
(test_tissue_corr_computation): ... a pytest function.
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py b/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py index a8cf6006..4060d0e5 100644 --- a/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py +++ b/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py @@ -7,24 +7,19 @@ from wqflask.correlation.correlation_functions import get_trait_symbol_and_tissu from wqflask.correlation.correlation_functions import cal_zero_order_corr_for_tiss -class TestCorrelationFunctions(unittest.TestCase): - """test for correlation helper functions""" +def test_tissue_corr_computation(mocker): + """Test for cal_zero_order_corr_for_tiss""" + primary_values = [9.288, 9.313, 8.988, 9.660, 8.21] + target_values = [9.586, 8.498, 9.362, 8.820, 8.786] + _m = mocker.patch(("wqflask.correlation.correlation_functions." + "compute_corr_coeff_p_value"), + return_value=(0.51, 0.7)) + results = cal_zero_order_corr_for_tiss(primary_values, target_values) + _m.assert_called_once_with( + primary_values=primary_values, target_values=target_values, + corr_method="pearson") + assert len(results) == 3 - @mock.patch("wqflask.correlation.correlation_functions.compute_corr_coeff_p_value") - def test_tissue_corr_computation(self, mock_tiss_corr_computation): - """test for cal_zero_order_corr_for_tiss""" - - primary_values = [9.288, 9.313, 8.988, 9.660, 8.21] - target_values = [9.586, 8.498, 9.362, 8.820, 8.786] - - mock_tiss_corr_computation.return_value = (0.51, 0.7) - - results = cal_zero_order_corr_for_tiss(primary_values, target_values) - mock_tiss_corr_computation.assert_called_once_with( - primary_values=primary_values, target_values=target_values, - corr_method="pearson") - - self.assertEqual(len(results), 3) @mock.patch("wqflask.correlation.correlation_functions.MrnaAssayTissueData") def test_get_trait_symbol_and_tissue_values(self, mock_class): |