aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-04-17 04:16:06 +0300
committerAlexander Kabui2021-04-17 04:16:06 +0300
commite8dddf89e0736b024aa28d4170a5865f6869f7da (patch)
tree2f777d617d4e93026e461b3381fc461d3d335654
parent04965d0157a9b6545dbd1007685f7c3defa26e61 (diff)
downloadgenenetwork3-e8dddf89e0736b024aa28d4170a5865f6869f7da.tar.gz
refactor tests for lit
-rw-r--r--tests/unit/computations/test_correlation.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py
index 26a5d29..a8d199d 100644
--- a/tests/unit/computations/test_correlation.py
+++ b/tests/unit/computations/test_correlation.py
@@ -381,20 +381,16 @@ class TestCorrelation(TestCase):
database = mock.Mock()
- expected_mocked_lit_results = [{"gene_id": 11, "lit_corr": 9}, {
- "gene_id": 17, "lit_corr": 8}]
+ expected_mocked_lit_results = [{"1412_at": {"gene_id": 11, "lit_corr": 0.9}}, {"1412_a": {
+ "gene_id": 17, "lit_corr": 0.48}}]
- mock_lit_corr.side_effect = expected_mocked_lit_results
+ mock_lit_corr.return_value = expected_mocked_lit_results
lit_correlation_results = compute_all_lit_correlation(
- conn=database, trait_lists=[{"gene_id": 11}],
+ conn=database, trait_lists=[("1412_at", 11), ("1412_a", 121)],
species="rat", gene_id=12)
- expected_results = {
- "lit_results": {"gene_id": 11, "lit_corr": 9}
- }
-
- self.assertEqual(lit_correlation_results, expected_results)
+ self.assertEqual(lit_correlation_results, expected_mocked_lit_results)
@mock.patch("gn3.computations.correlations.tissue_correlation_for_trait_list")
@mock.patch("gn3.computations.correlations.process_trait_symbol_dict")
@@ -421,10 +417,8 @@ class TestCorrelation(TestCase):
mock_tissue_corr.side_effect = [{"tissue_corr": -0.5, "p_value": 0.9, "tissue_number": 3},
{"tissue_corr": 1.11, "p_value": 0.2, "tissue_number": 3}]
- expected_results = {"1418702_a_at":
- {"tissue_corr": -0.5, "p_value": 0.9, "tissue_number": 3},
- "1412_at":
- {"tissue_corr": 1.11, "p_value": 0.2, "tissue_number": 3}}
+ expected_results = [{"1412_at": {"tissue_corr": 1.11, "p_value": 0.2, "tissue_number": 3}},
+ {"1418702_a_at": {"tissue_corr": -0.5, "p_value": 0.9, "tissue_number": 3}}]
results = compute_all_tissue_correlation(
primary_tissue_dict=primary_tissue_dict,