diff options
author | Alexander Kabui | 2021-11-28 23:30:09 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-12-10 09:58:29 +0300 |
commit | d253a9bc5e4831da03df45c7b0b73ed4456853b9 (patch) | |
tree | 27cf1b77a2f41b56c63f2d125075a349a3f928f4 /tests/unit/computations | |
parent | 31c6412b19a10cfb78a3f3294e6acec9811a7ee8 (diff) | |
download | genenetwork3-d253a9bc5e4831da03df45c7b0b73ed4456853b9.tar.gz |
refactor unittest for normalizing sample values
Diffstat (limited to 'tests/unit/computations')
-rw-r--r-- | tests/unit/computations/test_correlation.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index d60dd62..8b50f0e 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -94,14 +94,19 @@ class TestCorrelation(TestCase): def test_normalize_values(self): """Function to test normalizing values """ - results = normalize_values([2.3, None, None, 3.2, 4.1, 5], - [3.4, 7.2, 1.3, None, 6.2, 4.1]) - expected_results = [(2.3, 4.1, 5), (3.4, 6.2, 4.1)] + test_data = [ + [[2.3, None, None, 3.2, 4.1, 5], [3.4, 7.2, 1.3, None, 6.2, 4.1], + [(2.3, 4.1, 5), (3.4, 6.2, 4.1)]], + [[2.3, None, 1.3, None], [None, None, None, 1.2], []], + [[], [], []] + ] - self.assertEqual(list(zip(*list(results))), expected_results) + for a_values, b_values, expected_result in test_data: + with self.subTest(a_values=a_values, b_values=b_values): + results = normalize_values(a_values, b_values) + self.assertEqual(list(zip(*list(results))), expected_result) - @unittest.skip("reason for skipping") @mock.patch("gn3.computations.correlations.compute_corr_coeff_p_value") @mock.patch("gn3.computations.correlations.normalize_values") def test_compute_sample_r_correlation(self, norm_vals, compute_corr): |