aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests
diff options
context:
space:
mode:
authorAlexanderlacuna2020-11-09 16:53:12 +0300
committerAlexanderlacuna2020-11-09 16:53:12 +0300
commit986b20363cc84be1822588dd7cc935fca7ef7f48 (patch)
tree18e2c82093755cd6b9e4a4af7bbb3d6802feaaf8 /wqflask/tests
parent74c65eb99be3f9854bd774dae15877af7c8aa4f5 (diff)
downloadgenenetwork2-986b20363cc84be1822588dd7cc935fca7ef7f48.tar.gz
add test for get_genofile_samplelist in marker_regression/run_mapping.py
Diffstat (limited to 'wqflask/tests')
-rw-r--r--wqflask/tests/wqflask/marker_regression/test_run_mapping.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/wqflask/tests/wqflask/marker_regression/test_run_mapping.py b/wqflask/tests/wqflask/marker_regression/test_run_mapping.py
new file mode 100644
index 00000000..0a5bc565
--- /dev/null
+++ b/wqflask/tests/wqflask/marker_regression/test_run_mapping.py
@@ -0,0 +1,36 @@
+import unittest
+from unittest import mock
+from wqflask.marker_regression.run_mapping import get_genofile_samplelist
+
+
+class AttributeSetter:
+ def __init__(self,obj):
+ for k,v in obj.items():
+ setattr(self,k,v)
+
+
+class MockDataSetGroup(AttributeSetter):
+
+ def get_genofiles(self):
+ return [{"location":"~/genofiles/g1_file","sample_list":["S1","S2","S3","S4"]}]
+class TestRunMapping(unittest.TestCase):
+ def setUp(self):
+ self.group=MockDataSetGroup({"genofile":"~/genofiles/g1_file"})
+ self.dataset=AttributeSetter({"group":self.group})
+
+ def tearDown(self):
+ self.dataset=AttributeSetter({"group":{"location":"~/genofiles/g1_file"}})
+
+
+ def test_get_genofile_samplelist(self):
+ #location true and sample list true
+
+ results_1=get_genofile_samplelist(self.dataset)
+ self.assertEqual(results_1,["S1","S2","S3","S4"])
+ #return empty array
+ self.group.genofile="~/genofiles/g2_file"
+ result_2=get_genofile_samplelist(self.dataset)
+ self.assertEqual(result_2,[])
+
+
+