Skip to content

Commit bbaa05b

Browse files
committed
test subscope behavior
1 parent 448e1ad commit bbaa05b

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

cwl_utils/expression_refactor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
TYPE_CHECKING,
1212
Any,
1313
Callable,
14-
Dict,
1514
List,
1615
MutableMapping,
1716
MutableSequence,

tests/test_subscope.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
"""Test that scoping of identifiers in Workflow.steps[].run is correct."""
3+
4+
from pathlib import Path
5+
6+
from cwl_utils.parser import Workflow, load_document_by_uri
7+
8+
HERE = Path(__file__).resolve().parent
9+
10+
11+
def test_workflow_step_process_scope_v1_0() -> None:
12+
"""CWL v1.0 IDs under Workflow.steps[].run should not be scoped in the "run" scope."""
13+
uri = Path(HERE / "../testdata/workflow_input_format_expr.cwl").resolve().as_uri()
14+
cwl_obj: Workflow = load_document_by_uri(uri)
15+
assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/target")
16+
17+
18+
def test_workflow_step_process_scope_v1_1() -> None:
19+
"""CWL v1.1 IDs under Workflow.steps[].run should be scoped in the "run" scope."""
20+
uri = (
21+
Path(HERE / "../testdata/workflow_input_format_expr_v1_1.cwl")
22+
.resolve()
23+
.as_uri()
24+
)
25+
cwl_obj: Workflow = load_document_by_uri(uri)
26+
assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target")
27+
28+
29+
def test_workflow_step_process_scope_v1_2() -> None:
30+
"""CWL v1.2 IDs under Workflow.steps[].run should be scoped in the "run" scope."""
31+
uri = (
32+
Path(HERE / "../testdata/workflow_input_format_expr_v1_2.cwl")
33+
.resolve()
34+
.as_uri()
35+
)
36+
cwl_obj: Workflow = load_document_by_uri(uri)
37+
assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target")

0 commit comments

Comments
 (0)