Skip to content

Commit 46ffbb2

Browse files
Fixed doc and import
1 parent fc20a46 commit 46ffbb2

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

cwl_utils/file_formats.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""
2+
CWL file formats utilities.
3+
4+
For more information, please visit https://www.commonwl.org/user_guide/16-file-formats/
5+
"""
6+
17
from typing import List, Optional, Set, Union
28

39
from rdflib import Graph, OWL, RDFS, URIRef

tests/test_format.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
from schema_salad.exceptions import ValidationException
99
from schema_salad.fetcher import DefaultFetcher
1010

11-
from cwl_utils.format import check_format
11+
from cwl_utils.file_formats import check_format
12+
from cwl_utils.types import CWLObjectType
1213

1314

14-
def _create_file(format_: Optional[str] = None):
15+
def _create_file(format_: Optional[str] = None) -> CWLObjectType:
1516
obj = {
1617
"class": "File",
1718
"basename": "example.txt",
@@ -25,7 +26,7 @@ def _create_file(format_: Optional[str] = None):
2526
return obj
2627

2728

28-
def _load_format(fetchurl: str):
29+
def _load_format(fetchurl: str) -> Graph:
2930
fetcher = DefaultFetcher({}, requests.Session())
3031
content = fetcher.fetch_text(fetchurl)
3132
graph = Graph()
@@ -38,15 +39,15 @@ def _load_format(fetchurl: str):
3839
return graph
3940

4041

41-
def test_check_format():
42+
def test_check_format() -> None:
4243
check_format(
4344
actual_file=_create_file(format_="http://edamontology.org/format_2330"),
4445
input_formats="http://edamontology.org/format_2330",
4546
ontology=_load_format("http://edamontology.org/EDAM.owl"),
4647
)
4748

4849

49-
def test_check_format_no_format():
50+
def test_check_format_no_format() -> None:
5051
with raises(ValidationException, match=r"File has no 'format' defined: .*"):
5152
check_format(
5253
actual_file=_create_file(),
@@ -55,7 +56,7 @@ def test_check_format_no_format():
5556
)
5657

5758

58-
def test_check_format_no_input_formats():
59+
def test_check_format_no_input_formats() -> None:
5960
with raises(ValidationException, match=r"File has an incompatible format: .*"):
6061
check_format(
6162
actual_file=_create_file(format_="http://edamontology.org/format_2330"),
@@ -64,7 +65,7 @@ def test_check_format_no_input_formats():
6465
)
6566

6667

67-
def test_check_format_no_ontology():
68+
def test_check_format_no_ontology() -> None:
6869
check_format(
6970
actual_file=_create_file(format_="http://edamontology.org/format_2330"),
7071
input_formats="http://edamontology.org/format_2330",

0 commit comments

Comments
 (0)