diff options
author | Frederick Muriuki Muriithi | 2021-10-21 07:11:41 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2021-10-21 07:11:41 +0300 |
commit | 6818670686de86c86b6c1aa372135ab6c22af156 (patch) | |
tree | 73b3d111d68225e85b691d85ed06db2869334875 /tests/unit/test_partial_correlations.py | |
parent | d603df2b7a50167319c8e26e101e29cef55b3a7a (diff) | |
download | genenetwork3-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/test_partial_correlations.py')
-rw-r--r-- | tests/unit/test_partial_correlations.py | 31 |
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, |