8
8
from schema_salad .exceptions import ValidationException
9
9
from schema_salad .fetcher import DefaultFetcher
10
10
11
- from cwl_utils .format import check_format
11
+ from cwl_utils .file_formats import check_format
12
+ from cwl_utils .types import CWLObjectType
12
13
13
14
14
- def _create_file (format_ : Optional [str ] = None ):
15
+ def _create_file (format_ : Optional [str ] = None ) -> CWLObjectType :
15
16
obj = {
16
17
"class" : "File" ,
17
18
"basename" : "example.txt" ,
@@ -25,7 +26,7 @@ def _create_file(format_: Optional[str] = None):
25
26
return obj
26
27
27
28
28
- def _load_format (fetchurl : str ):
29
+ def _load_format (fetchurl : str ) -> Graph :
29
30
fetcher = DefaultFetcher ({}, requests .Session ())
30
31
content = fetcher .fetch_text (fetchurl )
31
32
graph = Graph ()
@@ -38,15 +39,15 @@ def _load_format(fetchurl: str):
38
39
return graph
39
40
40
41
41
- def test_check_format ():
42
+ def test_check_format () -> None :
42
43
check_format (
43
44
actual_file = _create_file (format_ = "http://edamontology.org/format_2330" ),
44
45
input_formats = "http://edamontology.org/format_2330" ,
45
46
ontology = _load_format ("http://edamontology.org/EDAM.owl" ),
46
47
)
47
48
48
49
49
- def test_check_format_no_format ():
50
+ def test_check_format_no_format () -> None :
50
51
with raises (ValidationException , match = r"File has no 'format' defined: .*" ):
51
52
check_format (
52
53
actual_file = _create_file (),
@@ -55,7 +56,7 @@ def test_check_format_no_format():
55
56
)
56
57
57
58
58
- def test_check_format_no_input_formats ():
59
+ def test_check_format_no_input_formats () -> None :
59
60
with raises (ValidationException , match = r"File has an incompatible format: .*" ):
60
61
check_format (
61
62
actual_file = _create_file (format_ = "http://edamontology.org/format_2330" ),
@@ -64,7 +65,7 @@ def test_check_format_no_input_formats():
64
65
)
65
66
66
67
67
- def test_check_format_no_ontology ():
68
+ def test_check_format_no_ontology () -> None :
68
69
check_format (
69
70
actual_file = _create_file (format_ = "http://edamontology.org/format_2330" ),
70
71
input_formats = "http://edamontology.org/format_2330" ,
0 commit comments