From e3b7d9a24fb38397d4c393503463973d677925fb Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 7 Sep 2022 11:51:38 +0300 Subject: Move test case to mrna_assay_tissue_data test module * wqflask/tests/unit/base/test_mrna_assay_tissue_data.py * wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py (TestCorrelationFunctions.test_tissue_corr_computation): Delete. (TestCorrelationFunctions): Move this ... (test_mrna_assay_tissue_data_initialisation): ... here --- .../tests/unit/base/test_mrna_assay_tissue_data.py | 22 ++++++++++++++++++++++ .../correlation/test_correlation_functions.py | 14 -------------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'wqflask/tests/unit') diff --git a/wqflask/tests/unit/base/test_mrna_assay_tissue_data.py b/wqflask/tests/unit/base/test_mrna_assay_tissue_data.py index 7a21124a..ecaa9def 100644 --- a/wqflask/tests/unit/base/test_mrna_assay_tissue_data.py +++ b/wqflask/tests/unit/base/test_mrna_assay_tissue_data.py @@ -49,3 +49,25 @@ def test_mrna_assay_tissue_data_initialisation(mocker, gene_symbols, cursor.fetchall.return_value = sql_fetch_all_results MrnaAssayTissueData(conn=mock_conn, gene_symbols=gene_symbols) cursor.execute.assert_called_with(*expected_query) + + +def test_get_trait_symbol_and_tissue_values(mocker): + """Test for getting trait symbol and tissue_values""" + mock_conn = mocker.MagicMock() + with mock_conn.cursor() as cursor: + cursor.fetchall.side_effect = [ + (("k1", "203", + "112", "xy", "20.11", + "Sample Description", + "Sample Probe Target Description"),), + (("k1", "v1"), + ("k2", "v2"), + ("k3", "v3")), + ] + _m = MrnaAssayTissueData(conn=mock_conn, + gene_symbols=["k1", "k2", "k3"]) + assert _m.get_symbol_values_pairs() == { + "k1": ["v1"], + "k2": ["v2"], + "k3": ["v3"], + } diff --git a/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py b/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py index 4060d0e5..bb07d41e 100644 --- a/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py +++ b/wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py @@ -19,17 +19,3 @@ def test_tissue_corr_computation(mocker): primary_values=primary_values, target_values=target_values, corr_method="pearson") assert len(results) == 3 - - - @mock.patch("wqflask.correlation.correlation_functions.MrnaAssayTissueData") - def test_get_trait_symbol_and_tissue_values(self, mock_class): - """test for getting trait symbol and tissue_values""" - mock_class_instance = mock_class.return_value - mock_class_instance.gene_symbols = ["k1", "k2", "k3"] - mock_class_instance.get_symbol_values_pairs.return_value = { - "k1": ["v1", "v2", "v3"], "k2": ["v2", "v3"], "k3": ["k3"]} - results = get_trait_symbol_and_tissue_values( - symbol_list=["k1", "k2", "k3"]) - mock_class.assert_called_with(gene_symbols=['k1', 'k2', 'k3']) - self.assertEqual({"k1": ["v1", "v2", "v3"], "k2": [ - "v2", "v3"], "k3": ["k3"]}, results) -- cgit v1.2.3