From d253a9bc5e4831da03df45c7b0b73ed4456853b9 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Sun, 28 Nov 2021 23:30:09 +0300 Subject: refactor unittest for normalizing sample values --- tests/unit/computations/test_correlation.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tests') 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): -- cgit v1.2.3