Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit 4306c15

Browse files
committed
Adds unit tests for output of array type
1 parent 3ec6ebd commit 4306c15

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_unit_cwlgen.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def setUp(self):
6161
self.param = cwlgen.Parameter('an_id', param_type='File', label='a_label',\
6262
doc='a_doc', param_format='a_format',\
6363
streamable=True, secondary_files='sec_files')
64+
self.nonfile_param = cwlgen.Parameter('non-file', param_type="string", label="a string",
65+
streamable=True, secondary_files=[".txt"], doc="documentation here")
66+
67+
self.array_param = cwlgen.Parameter('an array', param_type='string[]', label="an array of strings")
6468

6569
def test_init(self):
6670
self.assertEqual(self.param.id, 'an_id')
@@ -80,6 +84,21 @@ def test_get_dict(self):
8084
self.assertEqual(dict_test['secondaryFiles'], 'sec_files')
8185
self.assertTrue(dict_test['streamable'])
8286

87+
def test_nonfile_get_dict(self):
88+
dict_test = self.nonfile_param.get_dict()
89+
self.assertEqual(dict_test['type'], 'string')
90+
self.assertEqual(dict_test['doc'], self.nonfile_param.doc)
91+
self.assertNotIn('secondaryFiles', dict_test)
92+
self.assertNotIn('streamable', dict_test)
93+
self.assertNotIn('format', dict_test)
94+
95+
def test_array(self):
96+
dict_test = self.array_param.get_dict()
97+
td = dict_test['type']
98+
self.assertIsInstance(td, dict)
99+
self.assertEqual(td['type'], 'array')
100+
self.assertEqual(td['items'], self.array_param.type.items)
101+
83102

84103
class TestCommandInputParameter(unittest.TestCase):
85104

0 commit comments

Comments
 (0)