-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests For write_map and read_map #9
base: master
Are you sure you want to change the base?
Changes from all commits
25f2de3
5e4f312
5d6c354
b94e3ab
8476c6a
b53f320
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version 1.0 | ||
import "map_task.wdl" as map_wdl | ||
|
||
workflow wf { | ||
call map_wdl.make_test_cases as mk | ||
Map[File, Int] map_int = {mk.files[0]: 1, mk.files[1]: 2, mk.files[2]: 3} | ||
Map[File, Boolean] map_bool = {mk.files[0]: true, mk.files[1]: false, mk.files[2]: false} | ||
|
||
call map_wdl.write_map as write_map { | ||
input: | ||
map_of_ints = map_int, | ||
map_of_booleans = map_bool | ||
} | ||
|
||
call map_wdl.read_map | ||
|
||
output { | ||
File out_file_int = write_map.out1 | ||
File out_file_bool = write_map.out2 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
version 1.0 | ||
|
||
task make_test_cases { | ||
command { | ||
} | ||
output { | ||
Array[String] files = ["f1", "f2", "f3"] | ||
} | ||
runtime { | ||
docker: "python:3-slim" | ||
} | ||
} | ||
|
||
task write_map { | ||
input { | ||
Map[String, Int] map_of_ints | ||
Map[String, Boolean] map_of_booleans | ||
# output files for each map type tests | ||
String out_file_two = "./output_map_of_ints.txt" | ||
String out_file_three = "./output_map_of_bools.txt" | ||
} | ||
command { | ||
cat ${write_map(map_of_ints)} > ~{out_file_two} | ||
cat ${write_map(map_of_booleans)} > ~{out_file_three} | ||
} | ||
output { | ||
File out1 = out_file_two | ||
File out2 = out_file_three | ||
} | ||
runtime { | ||
docker: "python:3-slim" | ||
} | ||
} | ||
|
||
task read_map { | ||
command <<< | ||
python3 <<CODE | ||
map = {'x': 500, 'y': 600, 'z': 700} | ||
print("\\n".join(["{}\\t{}".format(k,v) for k,v in map.items()])) | ||
CODE | ||
>>> | ||
output { | ||
Map[String, Int] out_map = read_map(stdout()) | ||
} | ||
runtime { | ||
docker: "python:3-slim" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
f1 alice | ||
f2 bob | ||
f3 chuck |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
f1 true | ||
f2 false | ||
f3 false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
f1 1 | ||
f2 2 | ||
f3 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
f1 true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file looks like an output from a workflow run that can be deleted |
||
f2 false | ||
f3 false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
f1 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file looks like an output from a workflow run that can be deleted |
||
f2 2 | ||
f3 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"out_file_int": { | ||
"name": "output_map_of_ints.txt" | ||
}, | ||
"out_file_bool": { | ||
"name": "output_map_of_bools.txt" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def test_map_literal(workflow_data, workflow_runner): | ||
expected = workflow_data.get_dict("out_file_int", "out_file_bool") | ||
input={} | ||
workflow_runner( | ||
"../main.wdl", | ||
input, | ||
expected, | ||
workflow_name="wf", | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"final_workflow_outputs_dir": "./tests/test_map_serialization/tests/data/output_workflow" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this file actually used? |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file ever used?