diff options
author | Munyoki Kilyungi | 2022-09-07 11:51:38 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-09-08 14:26:19 +0300 |
commit | e3b7d9a24fb38397d4c393503463973d677925fb (patch) | |
tree | 6432ed44ce9f4770f095d2c1ccbc17085486b17b /wqflask/tests | |
parent | b6fadcc7e8de9d7041f2bb00dcd1ada518a1932c (diff) | |
download | genenetwork2-e3b7d9a24fb38397d4c393503463973d677925fb.tar.gz |
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
Diffstat (limited to 'wqflask/tests')
-rw-r--r-- | wqflask/tests/unit/base/test_mrna_assay_tissue_data.py | 22 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/correlation/test_correlation_functions.py | 14 |
2 files changed, 22 insertions, 14 deletions
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) |