about summary refs log tree commit diff
path: root/tests/unit/utility
diff options
context:
space:
mode:
authorAlexander Kabui2021-03-16 11:38:13 +0300
committerGitHub2021-03-16 11:38:13 +0300
commit56ce88ad31dec3cece63e9370ca4e4c02139753b (patch)
tree766504dfaca75a14cc91fc3d88c41d1e775d415f /tests/unit/utility
parent43d1bb7f6cd2b5890d5b3eb7c357caafda25a35c (diff)
downloadgenenetwork3-56ce88ad31dec3cece63e9370ca4e4c02139753b.tar.gz
delete unwanted correlation stuff (#5)
* delete unwanted correlation stuff

* Refactor/clean up correlations (#4)

* initial commit for Refactor/clean-up-correlation

* add python scipy dependency

* initial commit for sample correlation

* initial commit for sample correlation endpoint

* initial commit for integration and unittest

* initial commit for registering  correlation blueprint

* add and modify unittest and integration tests for correlation

* Add compute compute_all_sample_corr   method for correlation

* add scipy to requirement txt file

* add tissue correlation for trait list

* add unittest for tissue correlation

* add lit correlation for trait list

* add unittests for lit correlation for trait list

* modify lit correlarion for trait list

* add unittests for lit correlation for trait list

* add correlation metho  in dynamic url

* add file format for expected structure input  while doing sample correlation

* modify input data structure -> add  trait id

* update tests for sample r correlation

* add compute all lit correlation method

* add endpoint for computing lit_corr

* add unit and integration tests for computing lit corr

* add /api/correlation/tissue_corr/{corr_method} endpoint for tissue correlation

* add unittest and integration tests for tissue correlation

Co-authored-by: BonfaceKilz <bonfacemunyoki@gmail.com>

* update guix scm file

* fix pylint error for correlations api

Co-authored-by: BonfaceKilz <bonfacemunyoki@gmail.com>
Diffstat (limited to 'tests/unit/utility')
-rw-r--r--tests/unit/utility/__init__.py0
-rw-r--r--tests/unit/utility/test_chunks.py19
-rw-r--r--tests/unit/utility/test_corr_result_helpers.py35
-rw-r--r--tests/unit/utility/test_hmac.py51
4 files changed, 0 insertions, 105 deletions
diff --git a/tests/unit/utility/__init__.py b/tests/unit/utility/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tests/unit/utility/__init__.py
+++ /dev/null
diff --git a/tests/unit/utility/test_chunks.py b/tests/unit/utility/test_chunks.py
deleted file mode 100644
index 7c42b44..0000000
--- a/tests/unit/utility/test_chunks.py
+++ /dev/null
@@ -1,19 +0,0 @@
-"""Test chunking"""
-
-import unittest
-
-from gn3.utility.chunks import divide_into_chunks
-
-
-class TestChunks(unittest.TestCase):
-    "Test Utility method for chunking"
-    def test_divide_into_chunks(self):
-        "Check that a list is chunked correctly"
-        self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 3),
-                         [[1, 2, 7], [3, 22, 8], [5, 22, 333]])
-        self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 4),
-                         [[1, 2, 7], [3, 22, 8], [5, 22, 333]])
-        self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 5),
-                         [[1, 2], [7, 3], [22, 8], [5, 22], [333]])
-        self.assertEqual(divide_into_chunks([], 5),
-                         [[]])
diff --git a/tests/unit/utility/test_corr_result_helpers.py b/tests/unit/utility/test_corr_result_helpers.py
deleted file mode 100644
index ce5891f..0000000
--- a/tests/unit/utility/test_corr_result_helpers.py
+++ /dev/null
@@ -1,35 +0,0 @@
-""" Test correlation helper methods """
-
-import unittest
-from gn3.utility.corr_result_helpers import normalize_values
-from gn3.utility.corr_result_helpers import common_keys
-from gn3.utility.corr_result_helpers import normalize_values_with_samples
-
-
-class TestCorrelationHelpers(unittest.TestCase):
-    """Test methods for normalising lists"""
-
-    def test_normalize_values(self):
-        """Test that a list is normalised correctly"""
-        self.assertEqual(
-            normalize_values([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], 3)
-        )
-
-    def test_common_keys(self):
-        """Test that common keys are returned as a list"""
-        test_a = dict(BXD1=9.113, BXD2=9.825, BXD14=8.985, BXD15=9.300)
-        test_b = dict(BXD1=9.723, BXD3=9.825, BXD14=9.124, BXD16=9.300)
-        self.assertEqual(sorted(common_keys(test_a, test_b)),
-                         ['BXD1', 'BXD14'])
-
-    def test_normalize_values_with_samples(self):
-        """Test that a sample(dict) is normalised correctly"""
-        self.assertEqual(
-            normalize_values_with_samples(
-                dict(BXD1=9.113, BXD2=9.825, BXD14=8.985,
-                     BXD15=9.300, BXD20=9.300),
-                dict(BXD1=9.723, BXD3=9.825, BXD14=9.124, BXD16=9.300)),
-            (({'BXD1': 9.113, 'BXD14': 8.985}, {'BXD1': 9.723, 'BXD14': 9.124}, 2))
-        )
diff --git a/tests/unit/utility/test_hmac.py b/tests/unit/utility/test_hmac.py
deleted file mode 100644
index eba25a3..0000000
--- a/tests/unit/utility/test_hmac.py
+++ /dev/null
@@ -1,51 +0,0 @@
-"""Test hmac utility functions"""
-# pylint: disable-all
-import unittest
-from unittest import mock
-
-from gn3.utility.hmac import data_hmac
-from gn3.utility.hmac import url_for_hmac
-from gn3.utility.hmac import hmac_creation
-
-
-class TestHmacUtil():
-    """Test Utility method for hmac creation"""
-
-    @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
-    def test_hmac_creation(self):
-        """Test hmac creation with a utf-8 string"""
-        self.assertEqual(hmac_creation("ファイ"), "7410466338cfe109e946")
-
-    @mock.patch("utility.hmac.app.config",
-                {'SECRET_HMAC_CODE': ('\x08\xdf\xfa\x93N\x80'
-                                      '\xd9\\H@\\\x9f`\x98d^'
-                                      '\xb4a;\xc6OM\x946a\xbc'
-                                      '\xfc\x80:*\xebc')})
-    def test_hmac_creation_with_cookie(self):
-        """Test hmac creation with a cookie"""
-        cookie = "3f4c1dbf-5b56-4260-87d6-f35445bda37e:af4fcf5eace9e7c864ce"
-        uuid_, _, signature = cookie.partition(":")
-        self.assertEqual(
-            hmac_creation(uuid_),
-            "af4fcf5eace9e7c864ce")
-
-    @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
-    def test_data_hmac(self):
-        """Test data_hmac fn with a utf-8 string"""
-        self.assertEqual(data_hmac("ファイ"), "ファイ:7410466338cfe109e946")
-
-    @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
-    @mock.patch("utility.hmac.url_for")
-    def test_url_for_hmac_with_plain_url(self, mock_url):
-        """Test url_for_hmac without params"""
-        mock_url.return_value = "https://mock_url.com/ファイ/"
-        self.assertEqual(url_for_hmac("ファイ"),
-                         "https://mock_url.com/ファイ/?hm=05bc39e659b1948f41e7")
-
-    @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
-    @mock.patch("utility.hmac.url_for")
-    def test_url_for_hmac_with_param_in_url(self, mock_url):
-        """Test url_for_hmac with params"""
-        mock_url.return_value = "https://mock_url.com/?ファイ=1"
-        self.assertEqual(url_for_hmac("ファイ"),
-                         "https://mock_url.com/?ファイ=1&hm=4709c1708270644aed79")