diff options
author | Alexander_Kabui | 2022-12-06 00:15:40 +0300 |
---|---|---|
committer | Alexander_Kabui | 2022-12-06 00:15:40 +0300 |
commit | 3df5321304435f601ae6f5f1865957cbc5a90ef7 (patch) | |
tree | aa8bddff4b33ccb6a9f857324699b75cd8d6eff8 /tests | |
parent | 156e6e4c372f3b4c24d5c07c02603a29d0d95412 (diff) | |
download | genenetwork3-3df5321304435f601ae6f5f1865957cbc5a90ef7.tar.gz |
update tests for lit correlation
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/computations/test_correlation.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index e8d4f75..d928239 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -58,12 +58,12 @@ class DataBase(QueryableMixin): """expects the expectede results value to be an array""" self.password = password self.db_name = db_name - self.__query_options = None # pylint: disable=[W0238] + self.__query_options = None # pylint: disable=[W0238] self.results_generator(expected_results) def execute(self, query_options): """method to execute an sql query""" - self.__query_options = query_options # pylint: disable=[W0238] + self.__query_options = query_options # pylint: disable=[W0238] return 1 def cursor(self): @@ -118,11 +118,9 @@ class TestCorrelation(TestCase): primary_values = [2.3, 4.1, 5, 4.2, None, None, 4, 1.2, 1.1] target_values = [3.4, 6.2, 4, 1.1, 1.2, None, 8, 1.1, 2.1] - norm_vals.return_value = iter( [(2.3, 3.4), (4.1, 6.2), (5, 4), (4.2, 1.1), (4, 8), (1.2, 1.1), (1.1, 2.1)]) - compute_corr.return_value = (0.8, 0.21) bicor_results = compute_sample_r_correlation(trait_name="1412_at", @@ -130,7 +128,6 @@ class TestCorrelation(TestCase): trait_vals=primary_values, target_samples_vals=target_values) - self.assertEqual(bicor_results, ("1412_at", 0.8, 0.21, 7)) @pytest.mark.unit_test @@ -266,7 +263,7 @@ class TestCorrelation(TestCase): input_mouse_gene_id=None, mouse_gene_id=None) - self.assertEqual(results, ("1", 0)) + self.assertEqual(results, ("1", None)) @pytest.mark.unit_test def test_fetch_lit_correlation_data_db_query(self): @@ -288,19 +285,17 @@ class TestCorrelation(TestCase): @pytest.mark.unit_test def test_query_lit_correlation_for_db_empty(self): - """Test that corr coeffient returned is 0 given the\ + """Test that corr coeffient returned is None given the\ db value if corr coefficient is empty """ conn = mock.Mock() conn.cursor.return_value = DataBase() - conn.execute.return_value.fetchone.return_value = None - - lit_results = fetch_lit_correlation_data(conn=conn, - input_mouse_gene_id="12", - gene_id="16", - mouse_gene_id="12") + conn.execute.return_value.fetchone.return_value = "" - self.assertEqual(lit_results, ("16", 0)) + self.assertEqual(fetch_lit_correlation_data(conn=conn, + input_mouse_gene_id="12", + gene_id="16", + mouse_gene_id="12"), ("16", None)) @pytest.mark.unit_test def test_query_formatter(self): |