aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests
diff options
context:
space:
mode:
authorAlexanderlacuna2020-11-11 23:08:14 +0300
committerAlexanderlacuna2020-11-11 23:08:14 +0300
commit8f85c96b2094a9ce722b93a0e375ec3de90c959a (patch)
tree7b5862bcc92b646ed17792f60183959afd9ba5ef /wqflask/tests
parent3396e1f008f3605439b38837f7a50407588d1f9b (diff)
downloadgenenetwork2-8f85c96b2094a9ce722b93a0e375ec3de90c959a.tar.gz
add tests for marker_regression/qtlreaper_mapping.py
Diffstat (limited to 'wqflask/tests')
-rw-r--r--wqflask/tests/wqflask/marker_regression/test_qtlreaper_mapping.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/wqflask/tests/wqflask/marker_regression/test_qtlreaper_mapping.py b/wqflask/tests/wqflask/marker_regression/test_qtlreaper_mapping.py
new file mode 100644
index 00000000..7ece663a
--- /dev/null
+++ b/wqflask/tests/wqflask/marker_regression/test_qtlreaper_mapping.py
@@ -0,0 +1,22 @@
+import unittest
+from unittest import mock
+from wqflask.marker_regression.qtlreaper_mapping import gen_pheno_txt_file
+from wqflask.marker_regression.qtlreaper_mapping import natural_sort
+
+#issues some methods in genofile object are not defined
+#modify samples should equal to vals
+class TestQtlReaperMapping(unittest.TestCase):
+ @mock.patch("wqflask.marker_regression.qtlreaper_mapping.TEMPDIR", "/home/user/data")
+ def test_gen_pheno_txt_file(self):
+ vals=["V1","x","V4","V3","x"]
+ samples=["S1","S2","S3","S4","S5"]
+ trait_filename="trait_file"
+ with mock.patch("builtins.open", mock.mock_open())as mock_open:
+ gen_pheno_txt_file(samples=samples,vals=vals,trait_filename=trait_filename)
+ mock_open.assert_called_once_with("/home/user/data/gn2/trait_file.txt","w")
+ filehandler=mock_open()
+ write_calls= [mock.call('Trait\t'),mock.call('S1\tS3\tS4\n'),mock.call('T1\t'),mock.call('V1\tV4\tV3')]
+
+ filehandler.write.assert_has_calls(write_calls)
+
+