Skip to content

Commit 8561612

Browse files
committed
more tests :-)
1 parent c3e1e5a commit 8561612

File tree

3 files changed

+100
-2
lines changed

3 files changed

+100
-2
lines changed

testdata/formattest2_v1_0.cwl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
$namespaces:
2+
edam: http://edamontology.org/
3+
$schemas:
4+
- EDAM.owl
5+
class: CommandLineTool
6+
cwlVersion: v1.0
7+
doc: "Reverse each line using the `rev` command"
8+
hints:
9+
DockerRequirement:
10+
dockerPull: docker.io/debian:stable-slim
11+
12+
inputs:
13+
input:
14+
type: File
15+
inputBinding: {}
16+
format: edam:format_2330
17+
18+
outputs:
19+
output:
20+
type: File
21+
outputBinding:
22+
glob: output.txt
23+
format: $(inputs.input.format)
24+
25+
baseCommand: rev
26+
stdout: output.txt

testdata/formattest2_v1_1.cwl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
$namespaces:
2+
edam: http://edamontology.org/
3+
$schemas:
4+
- EDAM.owl
5+
class: CommandLineTool
6+
cwlVersion: v1.1
7+
doc: "Reverse each line using the `rev` command"
8+
hints:
9+
DockerRequirement:
10+
dockerPull: docker.io/debian:stable-slim
11+
12+
inputs:
13+
input:
14+
type: File
15+
inputBinding: {}
16+
format: edam:format_2330
17+
18+
outputs:
19+
output:
20+
type: File
21+
outputBinding:
22+
glob: output.txt
23+
format: $(inputs.input.format)
24+
25+
baseCommand: rev
26+
stdout: output.txt

tests/test_format.py

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,54 @@ def test_check_format_no_ontology() -> None:
133133
)
134134

135135

136-
def test_loading_options_graph_property() -> None:
137-
"""Test that RDFLib Graph representations of $schema properties are correctly loaded."""
136+
def test_loading_options_graph_property_v1_0() -> None:
137+
"""Test that RDFLib Graph representations of $schema properties are correctly loaded, CWL v1.0."""
138+
uri = Path(HERE / "../testdata/formattest2_v1_0.cwl").resolve().as_uri()
139+
cwl_obj = load_document_by_uri(uri)
140+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(EDAM)
141+
142+
143+
def test_loading_options_graph_property_v1_1() -> None:
144+
"""Test that RDFLib Graph representations of $schema properties are correctly loaded, CWL v1.1."""
145+
uri = Path(HERE / "../testdata/formattest2_v1_1.cwl").resolve().as_uri()
146+
cwl_obj = load_document_by_uri(uri)
147+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(EDAM)
148+
149+
150+
def test_loading_options_graph_property_v1_2() -> None:
151+
"""Test that RDFLib Graph representations of $schema properties are correctly loaded, CWL v1.2."""
138152
uri = Path(HERE / "../testdata/formattest2.cwl").resolve().as_uri()
139153
cwl_obj = load_document_by_uri(uri)
140154
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(EDAM)
155+
156+
157+
def test_loading_options_missing_graph_v1_0() -> None:
158+
"""Affirm that v1.0 documents without $schema still produce an empty graph property."""
159+
uri = Path(HERE / "../testdata/workflow_input_format_expr.cwl").resolve().as_uri()
160+
cwl_obj = load_document_by_uri(uri)
161+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(Graph())
162+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(Graph())
163+
164+
165+
def test_loading_options_missing_graph_v1_1() -> None:
166+
"""Affirm that v1.1 documents without $schema still produce an empty graph property."""
167+
uri = (
168+
Path(HERE / "../testdata/workflow_input_format_expr_v1_1.cwl")
169+
.resolve()
170+
.as_uri()
171+
)
172+
cwl_obj = load_document_by_uri(uri)
173+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(Graph())
174+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(Graph())
175+
176+
177+
def test_loading_options_missing_graph_v1_2() -> None:
178+
"""Affirm that v1.2 documents without $schema still produce an empty graph property."""
179+
uri = (
180+
Path(HERE / "../testdata/workflow_input_format_expr_v1_2.cwl")
181+
.resolve()
182+
.as_uri()
183+
)
184+
cwl_obj = load_document_by_uri(uri)
185+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(Graph())
186+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(Graph())

0 commit comments

Comments
 (0)