From 204a308be0f741726b9a620d88fbc22b22124c81 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 29 Dec 2023 18:55:37 +0000 Subject: Namespace all modules under gn2. We move all modules under a gn2 directory. This is important for "correct" packaging and deployment as a Guix service. --- gn2/tests/unit/wqflask/correlation/__init__.py | 0 .../correlation/test_correlation_functions.py | 21 +++++++++++ .../wqflask/correlation/test_correlation_gn3.py | 14 ++++++++ .../wqflask/correlation/test_show_corr_results.py | 42 ++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 gn2/tests/unit/wqflask/correlation/__init__.py create mode 100644 gn2/tests/unit/wqflask/correlation/test_correlation_functions.py create mode 100644 gn2/tests/unit/wqflask/correlation/test_correlation_gn3.py create mode 100644 gn2/tests/unit/wqflask/correlation/test_show_corr_results.py (limited to 'gn2/tests/unit/wqflask/correlation') diff --git a/gn2/tests/unit/wqflask/correlation/__init__.py b/gn2/tests/unit/wqflask/correlation/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py b/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py new file mode 100644 index 00000000..c0f57141 --- /dev/null +++ b/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py @@ -0,0 +1,21 @@ +"""module contains tests for correlation functions""" + +import unittest +from unittest import mock + +from gn2.wqflask.correlation.correlation_functions import get_trait_symbol_and_tissue_values +from gn2.wqflask.correlation.correlation_functions import cal_zero_order_corr_for_tiss + + +def test_tissue_corr_computation(mocker): + """Test for cal_zero_order_corr_for_tiss""" + primary_values = [9.288, 9.313, 8.988, 9.660, 8.21] + target_values = [9.586, 8.498, 9.362, 8.820, 8.786] + _m = mocker.patch(("wqflask.correlation.correlation_functions." + "compute_corr_coeff_p_value"), + return_value=(0.51, 0.7)) + results = cal_zero_order_corr_for_tiss(primary_values, target_values) + _m.assert_called_once_with( + primary_values=primary_values, target_values=target_values, + corr_method="pearson") + assert len(results) == 3 diff --git a/gn2/tests/unit/wqflask/correlation/test_correlation_gn3.py b/gn2/tests/unit/wqflask/correlation/test_correlation_gn3.py new file mode 100644 index 00000000..432dbc95 --- /dev/null +++ b/gn2/tests/unit/wqflask/correlation/test_correlation_gn3.py @@ -0,0 +1,14 @@ +"""this module contains tests for code used in integrating to gn3 api""" +from unittest import TestCase +from gn2.base.data_set import create_dataset + +class TestCorrelation(TestCase): + + def test_create_dataset(self): + """test for creating datasets""" + + pass + def test_fetch_dataset_info(self): + """test for fetching dataset info data""" + + pass diff --git a/gn2/tests/unit/wqflask/correlation/test_show_corr_results.py b/gn2/tests/unit/wqflask/correlation/test_show_corr_results.py new file mode 100644 index 00000000..b1459dd9 --- /dev/null +++ b/gn2/tests/unit/wqflask/correlation/test_show_corr_results.py @@ -0,0 +1,42 @@ +import unittest +from unittest import mock +from gn2.wqflask.correlation.show_corr_results import get_header_fields + + +class AttributeSetter: + def __init__(self, trait_obj): + for key, value in trait_obj.items(): + setattr(self, key, value) + + +class TestShowCorrResults(unittest.TestCase): + def test_get_header_fields(self): + expected = [ + ['Index', + 'Record', + 'Symbol', + 'Description', + 'Location', + 'Mean', + 'Sample rho', + 'N', + 'Sample p(rho)', + 'Lit rho', + 'Tissue rho', + 'Tissue p(rho)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'], + + ['Index', + 'ID', + 'Location', + 'Sample r', + 'N', + 'Sample p(r)'] + + ] + result1 = get_header_fields("ProbeSet", "spearman") + result2 = get_header_fields("Other", "Other") + self.assertEqual(result1, expected[0]) + self.assertEqual(result2, expected[1]) -- cgit v1.2.3