diff options
author | Alexanderkabui | 2020-12-12 23:36:27 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-01-06 01:26:38 +0300 |
commit | b7e2d17536febbeb47dc91015781cc6fc4647905 (patch) | |
tree | a7c1c2b5983aa36dfb1ba6d2e46336906b1e248e /wqflask | |
parent | 0adae692f2f0ce509b32d6654438213deb3da89b (diff) | |
download | genenetwork2-b7e2d17536febbeb47dc91015781cc6fc4647905.tar.gz |
replace assertEqual with assertAlmostEqual for floats
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/tests/unit/wqflask/api/test_correlation.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/wqflask/tests/unit/wqflask/api/test_correlation.py b/wqflask/tests/unit/wqflask/api/test_correlation.py index 11c7d82b..9fa848a4 100644 --- a/wqflask/tests/unit/wqflask/api/test_correlation.py +++ b/wqflask/tests/unit/wqflask/api/test_correlation.py @@ -108,10 +108,12 @@ class TestCorrelations(unittest.TestCase): results_pearsonr=get_sample_r_and_p_values(this_trait=this_trait,this_dataset={},target_vals=target_vals,target_dataset=target_dataset,type="pearson") results_spearmanr=get_sample_r_and_p_values(this_trait=this_trait,this_dataset={},target_vals=target_vals,target_dataset=target_dataset,type="spearman") results_num_overlap=get_sample_r_and_p_values(this_trait=this_trait,this_dataset={},target_vals=target_vals,target_dataset=target_dataset,type="pearson") - self.assertEqual(mock_normalize.call_count,3) - - self.assertEqual(results_pearsonr,[-0.21618688834430866, 0.680771605997119, 6]) - self.assertEqual(results_spearmanr,[-0.11595420713048969, 0.826848213385815, 6]) + expected_pearsonr=[-0.21618688834430866, 0.680771605997119, 6] + expected_spearmanr=[-0.11595420713048969, 0.826848213385815, 6] + for i,val in enumerate(expected_pearsonr): + self.assertAlmostEqual(val,results_pearsonr[i]) + for i,val in enumerate(expected_spearmanr): + self.assertAlmostEqual(val,results_spearmanr[i]) self.assertEqual(results_num_overlap,None) @mock.patch("wqflask.api.correlation.do_literature_correlation_for_all_traits") @@ -133,7 +135,6 @@ class TestCorrelations(unittest.TestCase): - |