Skip to content

Commit 6eb7451

Browse files
Added graph property test
1 parent d82911b commit 6eb7451

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

testdata/formattest2.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.2
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import requests
88
from pytest import raises
99
from rdflib import Graph
10+
from rdflib.compare import to_isomorphic
1011
from rdflib.plugins.parsers.notation3 import BadSyntax
1112
from schema_salad.exceptions import ValidationException
1213
from schema_salad.fetcher import DefaultFetcher
1314

1415
from cwl_utils.file_formats import check_format
16+
from cwl_utils.parser import load_document_by_uri
1517
from cwl_utils.types import CWLObjectType
1618

1719

@@ -129,3 +131,10 @@ def test_check_format_no_ontology() -> None:
129131
input_formats="http://edamontology.org/format_2330",
130132
ontology=Graph(),
131133
)
134+
135+
136+
def test_loading_options_graph_property() -> None:
137+
"""Test that RDFLib Graph representations of $schema properties are correctly loaded."""
138+
uri = Path(HERE / "../testdata/formattest2.cwl").resolve().as_uri()
139+
cwl_obj = load_document_by_uri(uri)
140+
assert to_isomorphic(cwl_obj.loadingOptions.graph) == to_isomorphic(EDAM)

0 commit comments

Comments
 (0)