-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtests.py
87 lines (70 loc) · 4.32 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import unittest
from parse_gatk_json import CheetahPrep
class CheetahPrepTestCase(unittest.TestCase):
def setUp(self):
self.pname = "test_arg"
self.argname = "--test-arg"
self.mname = "MACRO_TEST"
self.section = "common"
self.pre_mname = "PRE_MACRO_TEST"
def test_req_chth_macro(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, "required", True, self.mname)
self.exp_chth = "#include source=$MACRO_TEST#"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_req_chth_premacro(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, "required", True, pre_mname=self.pre_mname)
self.exp_chth = "#include source=$PRE_MACRO_TEST#"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_req_chth(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, "required", True)
self.exp_chth = "--test-arg $test_arg"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_req_chth_bool(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, "required", is_req=True, is_bool=True)
self.exp_chth = "$test_arg"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_opt_chth(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, self.section)
self.exp_chth = "#if $common.test_arg\n --test-arg $common.test_arg\n#end if\n"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_opt_chth_bool(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, self.section, is_bool=True)
self.exp_chth = "#if $common.test_arg\n $common.test_arg\n#end if\n"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_opt_chth_macro(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, self.section, mname=self.mname)
self.exp_chth = "#include source=$MACRO_TEST#"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
def test_opt_chth_premacro(self):
self.chth_prep = CheetahPrep(self.pname, self.argname, self.section, pre_mname=self.pre_mname)
self.exp_chth = "#include source=$PRE_MACRO_TEST#"
self.assertEqual(self.chth_prep.chth, self.exp_chth)
# def test_req_chth_macro(self):
# self.chth_prep = CheetahPrep(self.pname, "required", True)
# self.exp_chth = "#if $%section.%out_sel_name\n%argument $%name\n#end if"
# self.assertEqual(self.chth_prep.chth, self.exp_chth)
if __name__ == '__main__':
unittest.main()
# self.chth_tmpl = PercentTemplate('#include source=$%macro#')
# self.req_out_chth = PercentTemplate('%argument $%name')
# self.vcf_choose = PercentTemplate('#if $%section.%name'
# '\n#if $%section.%name.is_of_type("vcf_bgzip")'
# '\n%argument %name.vcf.gz'
# '\n#else'
# '\n%argument %name.vcf'
# '\n#end if'
# '\n#end if')
# self.vcf_tabix = PercentTemplate('#if $%section.%name'
# '\n#set datatype = $%section.%name.datatype'
# '\n#if $%section.%name.is_of_type("vcf_bgzip")'
# '\nln -s $%section.%name %name.vcf.gz &&'
# '\ntabix %name.vcf.gz &&'
# '\n#else'
# '\nln -s $%section.%name %name.vcf &&'
# '\n#end if'
# '\n#end if')
# self.file_chth = PercentTemplate('#if $%section.%out_sel_name\n%argument $%name\n#end if')
# # self.file_chth_old_gal = PercentTemplate('#if str($output_opt.output_opt_sel) == "yes":\n#if $output_opt.%out_sel_name:\n%argument $%name\n#end if\n#end if')
# self.ext_arg = '#if $%section.%name\n %argument $%section.%name\n#end if\n'
# # self.ext_arg_old_gal = '#if str($%section.%{section}_sel) == "yes":\n#if $%section.%name:\n%argument $%section.%name\n#end if\n#end if'
# self.reg_arg = '#if $%name\n %argument $%name\n#end if\n'