1
1
import xml .sax
2
- from typing import Optional
2
+ from typing import Any , Optional
3
3
4
4
import requests
5
5
from pytest import raises
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
12
13
13
14
- def _create_file (format_ : Optional [str ] = None ):
14
+ def _create_file (format_ : Optional [str ] = None ) -> Any :
15
15
obj = {
16
16
"class" : "File" ,
17
17
"basename" : "example.txt" ,
@@ -25,7 +25,7 @@ def _create_file(format_: Optional[str] = None):
25
25
return obj
26
26
27
27
28
- def _load_format (fetchurl : str ):
28
+ def _load_format (fetchurl : str ) -> Graph :
29
29
fetcher = DefaultFetcher ({}, requests .Session ())
30
30
content = fetcher .fetch_text (fetchurl )
31
31
graph = Graph ()
@@ -38,15 +38,15 @@ def _load_format(fetchurl: str):
38
38
return graph
39
39
40
40
41
- def test_check_format ():
41
+ def test_check_format () -> None :
42
42
check_format (
43
43
actual_file = _create_file (format_ = "http://edamontology.org/format_2330" ),
44
44
input_formats = "http://edamontology.org/format_2330" ,
45
45
ontology = _load_format ("http://edamontology.org/EDAM.owl" ),
46
46
)
47
47
48
48
49
- def test_check_format_no_format ():
49
+ def test_check_format_no_format () -> None :
50
50
with raises (ValidationException , match = r"File has no 'format' defined: .*" ):
51
51
check_format (
52
52
actual_file = _create_file (),
@@ -55,7 +55,7 @@ def test_check_format_no_format():
55
55
)
56
56
57
57
58
- def test_check_format_no_input_formats ():
58
+ def test_check_format_no_input_formats () -> None :
59
59
with raises (ValidationException , match = r"File has an incompatible format: .*" ):
60
60
check_format (
61
61
actual_file = _create_file (format_ = "http://edamontology.org/format_2330" ),
@@ -64,7 +64,7 @@ def test_check_format_no_input_formats():
64
64
)
65
65
66
66
67
- def test_check_format_no_ontology ():
67
+ def test_check_format_no_ontology () -> None :
68
68
check_format (
69
69
actual_file = _create_file (format_ = "http://edamontology.org/format_2330" ),
70
70
input_formats = "http://edamontology.org/format_2330" ,
0 commit comments