Mercurial > repos > guerler > springsuite
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/planemo/lib/python3.7/site-packages/cwltool/tests/test_subgraph.py Fri Jul 31 00:18:57 2020 -0400 @@ -0,0 +1,41 @@ +import os + +from six.moves import urllib + +import pytest +import json + +from cwltool.context import LoadingContext +from cwltool.load_tool import load_tool +from cwltool.workflow import default_make_tool +from cwltool.subgraph import get_subgraph +from schema_salad.utils import convert_to_dict +from cwltool.resolver import Path, resolve_local +from .util import get_data, working_directory +from six import string_types +from .test_fetch import norm + +def test_get_subgraph(): + loadingContext = LoadingContext({"construct_tool_object": default_make_tool}) + wf = norm(Path(get_data("tests/subgraph/count-lines1-wf.cwl")).as_uri()) + loadingContext.do_update = False + tool = load_tool(wf, loadingContext) + + sg = norm(Path(get_data("tests/subgraph")).as_uri()) + + def clean(val): + if isinstance(val, string_types): + if val.startswith(sg): + return val[len(sg)+1:] + if isinstance(val, dict): + return {k: clean(v) for k,v in val.items()} + if isinstance(val, list): + return [clean(v) for v in val] + return val + + for a in ("file1", "file2", "file3", "count_output", + "output3", "output4", "output5", + "step1", "step2", "step3", "step4", "step5"): + extracted = get_subgraph([wf+"#"+a], tool) + with open(get_data("tests/subgraph/extract_"+a+".json")) as f: + assert json.load(f) == clean(convert_to_dict(extracted))