Skip to content

Commit e6af66f

Browse files
authored
Merge pull request #111 from common-workflow-language/fix-cwltest
redo merge of Any and location support
2 parents 88afedb + 54ab503 commit e6af66f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cwltool/cwltest.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ def compare(a, b): # type: (Any, Any) -> bool
3030
try:
3131
if isinstance(a, dict):
3232
if a.get("class") == "File":
33-
if a["path"] == "Any" or b["path"] == "Any":
33+
if "path" in a:
34+
comp = "path"
35+
else:
36+
comp = "location"
37+
if a[comp] == "Any" or b[comp] == "Any":
3438
return True
35-
if not (b["path"].endswith("/" + a["path"]) or ("/" not in b["path"] and a["path"] == b["path"])):
36-
raise CompareFail(u"%s does not end with %s" %(b["path"], a["path"]))
39+
if a[comp] and (not (b[comp].endswith("/" + a[comp])
40+
or ("/" not in b[comp] and a[comp] == b[comp]))):
41+
raise CompareFail(u"%s does not end with %s" %(b[comp], a[comp]))
3742
# ignore empty collections
3843
b = {k: v for k, v in b.iteritems()
39-
if not isinstance(v, (list, dict)) or len(v) > 0}
44+
if not isinstance(v, (list, dict)) or len(v) > 0}
4045
elif a.get("class") == "Directory":
4146
if len(a["listing"]) != len(b["listing"]):
4247
return False

0 commit comments

Comments
 (0)