This repository was archived by the owner on Jan 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Tests For write_map and read_map #9
Open
power10dan
wants to merge
6
commits into
openwdl:master
Choose a base branch
from
power10dan:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
25f2de3
Tests For write_map and read_map
5e4f312
Included Feedback From Previous Pull Request
5d6c354
Delete Dockerfile
b94e3ab
Made Docker To Run On Python:3-slim
8476c6a
Merge branch 'master' of https://github.com/power10dan/Testathon-2020
b53f320
Changed WDL Task Name From make_files To make_test_case And Removed e…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/test_map_serialization/tests/data/output_file_to_name.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| f1 alice | ||
| f2 bob | ||
| f3 chuck | ||
3 changes: 3 additions & 0 deletions
3
tests/test_map_serialization/tests/data/output_map_of_bools.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| f1 true | ||
| f2 false | ||
| f3 false |
3 changes: 3 additions & 0 deletions
3
tests/test_map_serialization/tests/data/output_map_of_ints.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| f1 1 | ||
| f2 2 | ||
| f3 3 |
3 changes: 3 additions & 0 deletions
3
.../wf/6a55f93e-929c-4f5c-ba08-126618145d36/call-write_map/execution/output_map_of_bools.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| f1 true | ||
|
Contributor
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 | ||
3 changes: 3 additions & 0 deletions
3
...w/wf/6a55f93e-929c-4f5c-ba08-126618145d36/call-write_map/execution/output_map_of_ints.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| f1 1 | ||
|
Contributor
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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
tests/test_map_serialization/tests/test_map_serialization.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| ) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
|
Contributor
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? |
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?