@@ -74,8 +74,17 @@ def test_check_format_equiv() -> None:
74
74
)
75
75
76
76
77
+ def test_check_format_equiv2 () -> None :
78
+ """Test of check_format with an equivalent format, in the reverse."""
79
+ check_format (
80
+ actual_file = _create_file (format_ = "http://galaxyproject.org/formats/fasta" ),
81
+ input_formats = "http://edamontology.org/format_1929" ,
82
+ ontology = EDAM + GX ,
83
+ )
84
+
85
+
77
86
def test_check_format_wrong_format () -> None :
78
- """Test of check_format with a non-match format."""
87
+ """Test of check_format with a non-match format with an ontology ."""
79
88
with raises (ValidationException , match = r"File has an incompatible format: .*" ):
80
89
check_format (
81
90
actual_file = _create_file (format_ = "http://edamontology.org/format_1929" ),
@@ -84,6 +93,16 @@ def test_check_format_wrong_format() -> None:
84
93
)
85
94
86
95
96
+ def test_check_format_wrong_format_no_ontology () -> None :
97
+ """Test of check_format with a non-match format."""
98
+ with raises (ValidationException , match = r"File has an incompatible format: .*" ):
99
+ check_format (
100
+ actual_file = _create_file (format_ = "http://edamontology.org/format_1929" ),
101
+ input_formats = "http://edamontology.org/format_2334" ,
102
+ ontology = None ,
103
+ )
104
+
105
+
87
106
def test_check_format_no_format () -> None :
88
107
"""Confirm that a missing format produces the expected exception."""
89
108
with raises (ValidationException , match = r"File has no 'format' defined: .*" ):
@@ -94,6 +113,15 @@ def test_check_format_no_format() -> None:
94
113
)
95
114
96
115
116
+ def test_check_format_missing_file () -> None :
117
+ """Confirm that a missing file produces no error."""
118
+ check_format (
119
+ actual_file = [{}],
120
+ input_formats = "http://edamontology.org/format_2330" ,
121
+ ontology = EDAM ,
122
+ )
123
+
124
+
97
125
def test_check_format_no_ontology () -> None :
98
126
"""Confirm that precisely matching formats without an ontology still match."""
99
127
check_format (
0 commit comments