Skip to content

Commit 72e1044

Browse files
author
Vasu Jaganath
committed
modify test2D to automate file creation
1 parent f201b2a commit 72e1044

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

cwltool/command_line_tool.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1497,14 +1497,17 @@ def collect_output(
14971497
else:
14981498

14991499
def recursively_insert(j_dict: Any, key: Any, val: Any) -> Any:
1500-
"""Recursively inserts a value into any dictionaries"""
1500+
"""This is a helper function that recursively inserts
1501+
a value into any dictionary."""
15011502
if isinstance(j_dict, List):
15021503
return [recursively_insert(x, key, val) for x in j_dict]
15031504
if isinstance(j_dict, Dict):
15041505
if j_dict.get("class") == "File":
15051506
j_dict[key] = val
15061507
else:
1507-
return {x: recursively_insert(y, key, val) for x, y in j_dict.items()}
1508+
return {
1509+
x: recursively_insert(y, key, val) for x, y in j_dict.items()
1510+
}
15081511
return j_dict
15091512

15101513
result = recursively_insert(result, "format", format_field)

tests/test_2D.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import subprocess
22
import sys
3+
from pathlib import Path
34

45
from .util import get_data
56

67

78
def test_output_2D_file_format() -> None:
8-
"""Test format tag for 2D output arrays."""
9+
"""A simple test for format tag fix for 2D output arrays."""
910

11+
Path("filename.txt").touch()
1012
params = [
1113
sys.executable,
1214
"-m",
1315
"cwltool",
16+
"--cachedir", # just so that the relative path of file works out
17+
"foo",
1418
get_data("tests/output_2D_file_format.cwl"),
1519
]
1620

0 commit comments

Comments
 (0)