aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-10-21 07:11:41 +0300
committerFrederick Muriuki Muriithi2021-10-21 07:11:41 +0300
commit6818670686de86c86b6c1aa372135ab6c22af156 (patch)
tree73b3d111d68225e85b691d85ed06db2869334875 /tests/unit
parentd603df2b7a50167319c8e26e101e29cef55b3a7a (diff)
downloadgenenetwork3-6818670686de86c86b6c1aa372135ab6c22af156.tar.gz
Document tests better
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Document the issues better to help with understanding what each test checks for.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_partial_correlations.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py
index 7631a71..c591c8f 100644
--- a/tests/unit/test_partial_correlations.py
+++ b/tests/unit/test_partial_correlations.py
@@ -106,6 +106,8 @@ class TestPartialCorrelations(TestCase):
def test_dictify_by_samples(self):
"""
+ Test that `dictify_by_samples` generates the appropriate dict
+
Given:
a sequence of sequences with sample names, values and variances, as
in the output of `gn3.partial_correlations.control_samples` or
@@ -133,7 +135,34 @@ class TestPartialCorrelations(TestCase):
dictified_control_samples)
def test_fix_samples(self):
- """Test that fix_samples fixes the values"""
+ """
+ Test that `fix_samples` returns only the common samples
+
+ Given:
+ - A primary trait
+ - A sequence of control samples
+ When:
+ - The two arguments are passed to `fix_samples`
+ Then:
+ - Only the names of the samples present in the primary trait that
+ are also present in ALL the control traits are present in the
+ return value
+ - Only the values of the samples present in the primary trait that
+ are also present in ALL the control traits are present in the
+ return value
+ - ALL the values for ALL the control traits are present in the
+ return value
+ - Only the variances of the samples present in the primary trait
+ that are also present in ALL the control traits are present in the
+ return value
+ - ALL the variances for ALL the control traits are present in the
+ return value
+ - The return value is a tuple of the above items, in the following
+ order:
+ ((sample_names, ...), (primary_trait_values, ...),
+ (control_traits_values, ...), (primary_trait_variances, ...)
+ (control_traits_variances, ...))
+ """
self.assertEqual(
fix_samples(
{"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879,