Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/cwltool/tests/test_subgraph.py @ 0:d30785e31577 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:18:57 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d30785e31577 |
---|---|
1 import os | |
2 | |
3 from six.moves import urllib | |
4 | |
5 import pytest | |
6 import json | |
7 | |
8 from cwltool.context import LoadingContext | |
9 from cwltool.load_tool import load_tool | |
10 from cwltool.workflow import default_make_tool | |
11 from cwltool.subgraph import get_subgraph | |
12 from schema_salad.utils import convert_to_dict | |
13 from cwltool.resolver import Path, resolve_local | |
14 from .util import get_data, working_directory | |
15 from six import string_types | |
16 from .test_fetch import norm | |
17 | |
18 def test_get_subgraph(): | |
19 loadingContext = LoadingContext({"construct_tool_object": default_make_tool}) | |
20 wf = norm(Path(get_data("tests/subgraph/count-lines1-wf.cwl")).as_uri()) | |
21 loadingContext.do_update = False | |
22 tool = load_tool(wf, loadingContext) | |
23 | |
24 sg = norm(Path(get_data("tests/subgraph")).as_uri()) | |
25 | |
26 def clean(val): | |
27 if isinstance(val, string_types): | |
28 if val.startswith(sg): | |
29 return val[len(sg)+1:] | |
30 if isinstance(val, dict): | |
31 return {k: clean(v) for k,v in val.items()} | |
32 if isinstance(val, list): | |
33 return [clean(v) for v in val] | |
34 return val | |
35 | |
36 for a in ("file1", "file2", "file3", "count_output", | |
37 "output3", "output4", "output5", | |
38 "step1", "step2", "step3", "step4", "step5"): | |
39 extracted = get_subgraph([wf+"#"+a], tool) | |
40 with open(get_data("tests/subgraph/extract_"+a+".json")) as f: | |
41 assert json.load(f) == clean(convert_to_dict(extracted)) |