File: test_subscope.py

package info (click to toggle)
cwl-utils 0.37-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,156 kB
  • sloc: python: 88,920; makefile: 141; javascript: 91
file content (37 lines) | stat: -rw-r--r-- 1,395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# SPDX-License-Identifier: Apache-2.0
"""Test that scoping of identifiers in Workflow.steps[].run is correct."""

from pathlib import Path

from cwl_utils.parser import Workflow, load_document_by_uri

from .util import get_data


def test_workflow_step_process_scope_v1_0() -> None:
    """CWL v1.0 IDs under Workflow.steps[].run should not be scoped in the "run" scope."""
    uri = Path(get_data("testdata/workflow_input_format_expr.cwl")).resolve().as_uri()
    cwl_obj: Workflow = load_document_by_uri(uri)
    assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/target")


def test_workflow_step_process_scope_v1_1() -> None:
    """CWL v1.1 IDs under Workflow.steps[].run should be scoped in the "run" scope."""
    uri = (
        Path(get_data("testdata/workflow_input_format_expr_v1_1.cwl"))
        .resolve()
        .as_uri()
    )
    cwl_obj: Workflow = load_document_by_uri(uri)
    assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target")


def test_workflow_step_process_scope_v1_2() -> None:
    """CWL v1.2 IDs under Workflow.steps[].run should be scoped in the "run" scope."""
    uri = (
        Path(get_data("testdata/workflow_input_format_expr_v1_2.cwl"))
        .resolve()
        .as_uri()
    )
    cwl_obj: Workflow = load_document_by_uri(uri)
    assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target")