Skip to content

Commit 9efc877

Browse files
committed
improve test coverage
1 parent f4174fb commit 9efc877

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

tests/test_format.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,17 @@ def test_check_format_equiv() -> None:
7474
)
7575

7676

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+
7786
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."""
7988
with raises(ValidationException, match=r"File has an incompatible format: .*"):
8089
check_format(
8190
actual_file=_create_file(format_="http://edamontology.org/format_1929"),
@@ -84,6 +93,16 @@ def test_check_format_wrong_format() -> None:
8493
)
8594

8695

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+
87106
def test_check_format_no_format() -> None:
88107
"""Confirm that a missing format produces the expected exception."""
89108
with raises(ValidationException, match=r"File has no 'format' defined: .*"):
@@ -94,6 +113,15 @@ def test_check_format_no_format() -> None:
94113
)
95114

96115

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+
97125
def test_check_format_no_ontology() -> None:
98126
"""Confirm that precisely matching formats without an ontology still match."""
99127
check_format(

0 commit comments

Comments
 (0)