diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/computations/test_correlation.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index b1bc6ef..6153c8a 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -19,6 +19,7 @@ from gn3.computations.correlations import compute_all_lit_correlation from gn3.computations.correlations import compute_all_tissue_correlation from gn3.computations.correlations import map_shared_keys_to_values from gn3.computations.correlations import process_trait_symbol_dict +from gn3.computations.correlations2 import compute_correlation class QueryableMixin: @@ -464,3 +465,28 @@ class TestCorrelation(TestCase): trait_symbol_dict, tissue_values_dict) self.assertEqual(results, [expected_results]) + + def test_compute_correlation(self): + for dbdata,userdata,expected in [ + [[None,None,None,None,None,None,None,None,None,None], + [None,None,None,None,None,None,None,None,None,None], + (0.0, 0)], + [[None,None,None,None,None,None,None,None,None,0], + [None,None,None,None,None,None,None,None,None,None], + (0.0, 0)], + [[None,None,None,None,None,None,None,None,None,0], + [None,None,None,None,None,None,None,None,None,0], + (0.0, 1)], + [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0], + (0, 10)], + [[9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87], + [9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87,9.87], + (0.9999999999999998, 10)], + [[9.3,2.2,5.4,7.2,6.4,7.6,3.8,1.8,8.4,0.2], + [0.6,3.97,5.82,8.21,1.65,4.55,6.72,9.5,7.33,2.34], + (-0.12720361919462056, 10)], + [[0,1,2,3,4,5,6,7,8,9], + [None,None,None,None,2,None,None,3,None,None], + (0.0, 2)]]: + with self.subTest(dbdata=dbdata, userdata=userdata): + self.assertEqual(compute_correlation(dbdata,userdata), expected) |