1313 ParameterMeta ,
1414)
1515
16+ from tests .helpers import non_blank_lines_list
17+
1618
1719class TestTaskGeneration (unittest .TestCase ):
1820 def test_simple_task (self ):
@@ -44,7 +46,7 @@ def test_readme(self):
4446 w .imports .append (Workflow .WorkflowImport ("tool_file" , "" ))
4547 w .inputs .append (Input (WdlType .parse_type ("String" ), "inputGreeting" ))
4648
47- inputs_map = {" taskGreeting" : " inputGreeting" }
49+ inputs_map = {' taskGreeting' : { 'value' : ' inputGreeting' } }
4850 w .calls .append (
4951 WorkflowCall ("Q.namspaced_task_identifier" , "task_alias" , inputs_map )
5052 )
@@ -234,15 +236,18 @@ def test_commandinp_array_inp(self):
234236class TestWorkflowGeneration (unittest .TestCase ):
235237 def test_hello_workflow (self ):
236238 # https://github.com/openwdl/wdl/#specifying-inputs-and-using-declarations
237- w = Workflow (" test" )
239+ w = Workflow (' test' )
238240
239241 w .calls .append (WorkflowCall (TestTaskGeneration .test_hello_tasks ().name ))
240-
242+ inputs_details = {
243+ 'salutation' : {'value' : 'Greetings' },
244+ 'name' : {'value' : 'Michael' }
245+ }
241246 w .calls .append (
242247 WorkflowCall (
243248 TestTaskGeneration .test_hello_tasks ().name ,
244- alias = " hello2" ,
245- inputs_map = { "salutation" : '"Greetings"' , "name" : '"Michael"' } ,
249+ alias = ' hello2' ,
250+ inputs_details = inputs_details ,
246251 )
247252 )
248253
@@ -255,8 +260,8 @@ def test_call_scatter(self):
255260 "i" ,
256261 "integers" ,
257262 [
258- WorkflowCall (Task (" task1" ).name , inputs_map = { " num" : "i" }),
259- WorkflowCall (Task (" task2" ).name , inputs_map = { " num" : " task1.output" }),
263+ WorkflowCall (Task (' task1' ).name , inputs_details = { ' num' : { 'value' : 'i' } }),
264+ WorkflowCall (Task (' task2' ).name , inputs_details = { ' num' : { 'value' : ' task1.output' } }),
260265 ],
261266 )
262267
@@ -267,19 +272,23 @@ def test_call_scatter(self):
267272
268273class TestWorkflowParameterMetaGeneration (unittest .TestCase ):
269274 def test_parameter_meta_scalar (self ):
270- w = Task ("param_meta_scalar" , parameter_meta = ParameterMeta (test = 42 ))
275+ task = Task ("param_meta_scalar" , parameter_meta = ParameterMeta (test = 42 ))
276+ task_str = task .get_string ()
277+ task_lines = non_blank_lines_list (task_str )
271278
272279 expected = """\
273280 task param_meta_scalar {
274281 parameter_meta {
275282 test: 42
276283 }
277284}"""
278- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
279- self .assertEqual (expected , derived_workflow_only )
285+ task_str = ' \n ' .join (task_lines [ 1 :])
286+ self .assertEqual (expected , task_str )
280287
281288 def test_parameter_meta_bool (self ):
282- w = Task ("param_meta_scalar" , parameter_meta = ParameterMeta (pos = True , neg = False ))
289+ task = Task ("param_meta_scalar" , parameter_meta = ParameterMeta (pos = True , neg = False ))
290+ task_str = task .get_string ()
291+ task_lines = non_blank_lines_list (task_str )
283292
284293 expected = """\
285294 task param_meta_scalar {
@@ -288,96 +297,104 @@ def test_parameter_meta_bool(self):
288297 neg: false
289298 }
290299}"""
291- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
292- self .assertEqual (expected , derived_workflow_only )
300+ task_str = ' \n ' .join (task_lines [ 1 :])
301+ self .assertEqual (expected , task_str )
293302
294303 def test_parameter_meta_string (self ):
295- w = Task (
296- "param_meta_string" , parameter_meta = ParameterMeta (other = "string value" )
297- )
304+ task = Task ("param_meta_string" , parameter_meta = ParameterMeta (other = "string value" ))
305+ task_str = task .get_string ()
306+ task_lines = non_blank_lines_list (task_str )
307+
298308
299309 expected = """\
300310 task param_meta_string {
301311 parameter_meta {
302312 other: "string value"
303313 }
304314}"""
305- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
306- self .assertEqual (expected , derived_workflow_only )
315+ task_str = ' \n ' .join (task_lines [ 1 :])
316+ self .assertEqual (expected , task_str )
307317
308318 def test_parameter_meta_obj (self ):
309- w = Task (
319+ task = Task (
310320 "param_meta_obj" ,
311321 parameter_meta = ParameterMeta (
312322 obj_value = ParameterMeta .ParamMetaAttribute (
313323 help = "This is help text" , scalar = 96
314324 )
315325 ),
316326 )
327+ task_str = task .get_string ()
328+ task_lines = non_blank_lines_list (task_str )
317329
318330 expected = """\
319331 task param_meta_obj {
320332 parameter_meta {
321333 obj_value: {help: "This is help text", scalar: 96}
322334 }
323335}"""
324- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
325- self .assertEqual (expected , derived_workflow_only )
336+ task_str = ' \n ' .join (task_lines [ 1 :])
337+ self .assertEqual (expected , task_str )
326338
327339 def test_parameter_meta_dict (self ):
328- w = Task (
340+ task = Task (
329341 "param_meta_obj" ,
330342 parameter_meta = ParameterMeta (
331343 obj_value = {
332344 "help" : "This is help text" , "scalar" : 96
333345 }
334346 ),
335347 )
348+ task_str = task .get_string ()
349+ task_lines = non_blank_lines_list (task_str )
336350
337351 expected = """\
338352 task param_meta_obj {
339353 parameter_meta {
340354 obj_value: {help: "This is help text", scalar: 96}
341355 }
342356}"""
343- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
344- self .assertEqual (expected , derived_workflow_only )
357+ task_str = ' \n ' .join (task_lines [ 1 :])
358+ self .assertEqual (expected , task_str )
345359
346360
347361class TestWorkflowMetaGeneration (unittest .TestCase ):
348362 def test_meta_scalar (self ):
349- w = Task ("meta_scalar" , meta = Meta (arbitrary_scalar = 42 ))
350-
363+ task = Task ("meta_scalar" , meta = Meta (arbitrary_scalar = 42 ))
364+ task_str = task .get_string ()
365+ task_lines = non_blank_lines_list (task_str )
351366 expected = """\
352367 task meta_scalar {
353368 meta {
354369 arbitrary_scalar: 42
355370 }
356371}"""
357- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
358- self .assertEqual (expected , derived_workflow_only )
372+ task_str = ' \n ' .join (task_lines [ 1 :])
373+ self .assertEqual (expected , task_str )
359374
360375 def test_meta_bool (self ):
361- w = Task ("meta_scalar" , meta = Meta (pos = True , neg = False ))
362-
376+ task = Task ("meta_scalar" , meta = Meta (pos = True , neg = False ))
377+ task_str = task .get_string ()
378+ task_lines = non_blank_lines_list (task_str )
363379 expected = """\
364380 task meta_scalar {
365381 meta {
366382 pos: true
367383 neg: false
368384 }
369385}"""
370- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
371- self .assertEqual (expected , derived_workflow_only )
386+ task_str = ' \n ' .join (task_lines [ 1 :])
387+ self .assertEqual (expected , task_str )
372388
373389 def test_meta_string (self ):
374- w = Task ("meta_string" , meta = Meta (author = "illusional" ))
375-
390+ task = Task ("meta_string" , meta = Meta (author = "illusional" ))
391+ task_str = task .get_string ()
392+ task_lines = non_blank_lines_list (task_str )
376393 expected = """\
377394 task meta_string {
378395 meta {
379396 author: "illusional"
380397 }
381398}"""
382- derived_workflow_only = "" .join (w . get_string (). splitlines ( keepends = True )[ 2 :])
383- self .assertEqual (expected , derived_workflow_only )
399+ task_str = ' \n ' .join (task_lines [ 1 :])
400+ self .assertEqual (expected , task_str )
0 commit comments