8000 start adding unit test to import feature · phenoflow/python-cwlgen@3d1db80 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d1db80

Browse files
committed
start adding unit test to import feature
1 parent c2237cb commit 3d1db80

File tree

3 files changed

+64
-14
lines changed

3 files changed

+64
-14
lines changed

test/import_cwl.cwl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
cwlVersion: v1.0
4+
id: tool_id
5+
label: a_label
6+
baseCommand: share
7+
class: CommandLineTool
8+
doc: "super_doc"
9+
stdin: "in"
10+
stderr: "err"
11+
stdout: "out"

test/test_unit_pycwl.py renamed to test/test_unit_cwlgen.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
#!/usr/bin/env python3
2-
3-
## Author(s): Kenzo-Hugo Hillion
4-
## Contact(s): kehillio@pasteur.fr
5-
## Python version: 3.6.0
6-
## Creation : 01-02-2017
1+
#!/usr/bin/env python
72

83
'''
94
Unit tests for cwlgen library
105
'''
116

12-
########### Import ###########
7+
# Import ------------------------------
138

149
# General libraries
1510
import os
@@ -19,13 +14,7 @@
1914
# External libraries
2015
import cwlgen
2116

22-
# Class and Objects
23-
24-
########### Constant(s) ###########
25-
26-
########### Function(s) ###########
27-
28-
########### Class(es) ###########
17+
# Class(es) ------------------------------
2918

3019
class TestCommandLineTool(unittest.TestCase):
3120

test/test_unit_import.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python
2+
3+
'''
4+
Unit tests for import feature of cwlgen library
5+
'''
6+
7+
# Import ------------------------------
8+
9+
# General libraries
10+
import os
11+
import filecmp
12+
import unittest
13+
14+
# External libraries
15+
from cwlgen.import_cwl import CWLToolParser
16+
17+
# Class(es) ------------------------------
18+
19+
class TestImport(unittest.TestCase):
20+
21+
def setUp(self):
22+
ctp = CWLToolParser()
23+
self.tool = ctp.import_cwl('test/import_cwl.cwl')
24+
25+
26+
class TestImportCWL(TestImport):
27+
28+
def test_load_id(self):
29+
self.assertEqual(self.tool.tool_id, 'tool_id')
30+
31+
def test_load_baseCommand(self):
32+
self.assertEqual(self.tool.base_command, 'share')
33+
34+
def test_load_label(self):
35+
self.assertEqual(self.tool.label, 'a_label')
36+
37+
def test_load_doc(self):
38+
self.assertEqual(self.tool.doc, 'super_doc')
39+
40+
def test_load_cwlVersion(self):
41+
self.assertEqual(self.tool.cwl_version, 'v1.0')
42+
43+
def test_load_stdin(self):
44+
self.assertEqual(self.tool.stdin, 'in')
45+
46+
def test_load_stderr(self):
47+
self.assertEqual(self.tool.stderr, 'err')
48+
49+
def test_load_stdout(self):
50+
self.assertEqual(self.tool.stdout, 'out')

0 commit comments

Comments
 (0)
0