about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexanderlacuna2020-11-03 20:15:39 +0300
committerAlexanderlacuna2020-11-03 20:15:39 +0300
commit4b6d964ccf484225f568361b3bc6136a758cd475 (patch)
treea40a60635c41a60daa022e97c9165d38f2351b10
parent7da9a5206800d305f97b025e180300ca451ac92d (diff)
downloadgenenetwork2-4b6d964ccf484225f568361b3bc6136a758cd475.tar.gz
add tests for the get_categorical_variables function
-rw-r--r--wqflask/tests/wqflask/show_trait/test_show_trait.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/wqflask/tests/wqflask/show_trait/test_show_trait.py b/wqflask/tests/wqflask/show_trait/test_show_trait.py
index ec45d558..f7133292 100644
--- a/wqflask/tests/wqflask/show_trait/test_show_trait.py
+++ b/wqflask/tests/wqflask/show_trait/test_show_trait.py
@@ -155,7 +155,22 @@ class TestTraits(unittest.TestCase):
         self.assertEqual(get_categorical_variables(trait, sample_list), [])
 
     def test_get_categorical_variables_with_sample_attributes(self):
-        pass
+        this_trait=TraitObject({"data":{
+            "Gene1":TraitObject({"extra_attributes":{"ex1":"ex1value"}}),
+            "Gene2":TraitObject({"extra_attributes":{"ex2":"ex2value"}}),
+            "Gene3":TraitObject({"extra_attributes":{"ex3":"ex3value"}})
+            }})
+        sample_list=TraitObject({"attributes":{
+             "sample_attribute_1":TraitObject({"name":"ex1"}),
+             "sample_attribute_2":TraitObject({"name":"ex2"}),
+             "sample_attribute_3":TraitObject({"name":"ex3"}),
+             "sample_attribute_4":TraitObject({"name":"not_in_extra_attributes"}),
+
+
+            }})
+
+        results=get_categorical_variables(this_trait,sample_list)
+        self.assertEqual(["ex1","ex2","ex3","not_in_extra_attributes"],results)
 
     def test_get_trait_units(self):
         """test for getting trait units"""