Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cwltool/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,11 @@
action = DirectoryAppendAction
else:
action = AppendAction
items = inptype["items"]
if items == "int" or items == "long":
atype = int

Check warning on line 908 in cwltool/argparser.py

View check run for this annotation

Codecov / codecov/patch

cwltool/argparser.py#L908

Added line #L908 was not covered by tests
elif items == "double" or items == "float":
atype = float

Check warning on line 910 in cwltool/argparser.py

View check run for this annotation

Codecov / codecov/patch

cwltool/argparser.py#L910

Added line #L910 was not covered by tests
elif isinstance(inptype, MutableMapping) and inptype["type"] == "enum":
atype = str
elif isinstance(inptype, MutableMapping) and inptype["type"] == "record":
Expand Down
81 changes: 81 additions & 0 deletions tests/test_toolargparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,62 @@
outputs: []
"""

script_f = """
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: ExpressionTool

inputs:
foo: int[]

expression: '{"bar": $(inputs.foo)}'

outputs: []
"""

script_g = """
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: ExpressionTool

inputs:
foo: long[]

expression: '{"bar": $(inputs.foo)}'

outputs: []
"""

script_h = """
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: ExpressionTool

inputs:
foo: float[]

expression: '{"bar": $(inputs.foo)}'

outputs: []
"""

script_i = """
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: ExpressionTool

inputs:
foo: double[]

expression: '{"bar": $(inputs.foo)}'

outputs: []
"""

scripts_argparse_params = [
("help", script_a, lambda x: ["--debug", x, "--input", get_data("tests/echo.cwl")]),
("boolean", script_b, lambda x: [x, "--help"]),
Expand All @@ -120,6 +176,31 @@
script_e,
lambda x: [x, "--foo", "http://example.com"],
),
(
"foo with f",
script_f,
lambda x: [x, "--foo", "1", "--foo", "2"],
),
(
"foo with g for long value (large number)",
script_g,
lambda x: [x, "--foo", str(2**31 + 10)],
),
(
"foo with g for long value (small number)",
script_g,
lambda x: [x, "--foo", str(-1 * (2**31) - 10)],
),
(
"foo with h",
script_h,
lambda x: [x, "--foo", "1.2", "--foo", "3.4"],
),
(
"foo with i",
script_i,
lambda x: [x, "--foo", "1.2", "--foo", "3.4"],
),
]


Expand Down