Skip to content

Commit

Permalink
specify output entity paths in Validate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
muddymudskipper committed Aug 15, 2024
1 parent f6ee106 commit 5533ba1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/test_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from cmem_plugin_reason.plugin_reason import ReasonPlugin
from cmem_plugin_reason.plugin_validate import ValidatePlugin
from cmem_plugin_reason.utils import REASONERS
from tests.utils import TestExecutionContext, needs_cmem

from . import __path__
Expand Down Expand Up @@ -96,15 +97,22 @@ def test_validate(errors: str) -> str:
output_entities=True,
).execute(None, context=TestExecutionContext(PROJECT_ID))

val_errors = ""
md_test = (Path(__path__[0]) / "test_validate.md").read_text()
paths = [p.path for p in result.schema.paths] # type: ignore[union-attr]
val_errors = ""

if next(iter(result.entities)).values[0][0] != md_test: # type: ignore[union-attr]
if next(iter(result.entities)).values[paths.index("markdown")][0] != md_test: # type: ignore[union-attr]
val_errors += 'EntityPath "markdown" output error. '

if next(iter(result.entities)).values[2][0] != "Full,DL,EL,QL,RL": # type: ignore[union-attr]
if (
next(iter(result.entities)).values[paths.index("ontology_graph_iri")][0] # type: ignore[union-attr]
!= VALIDATE_ONTOLOGY_GRAPH_IRI
):
val_errors += 'EntityPath "ontology_graph_iri" output error. '
if (
next(iter(result.entities)).values[paths.index("valid_profiles")][0] # type: ignore[union-attr]
!= "Full,DL,EL,QL,RL"
):
val_errors += 'EntityPath "valid_profiles" output error. '

if md_test != get_resource(PROJECT_ID, MD_FILENAME).decode():
val_errors += "Markdown file error. "

Expand All @@ -118,8 +126,7 @@ def test_validate(errors: str) -> str:
return errors

errors_list: list[str] = []
reasoners = ["elk", "emr", "hermit", "jfact", "structural", "whelk"]
for reasoner in reasoners:
for reasoner in REASONERS:
errors_list = test_reasoner(reasoner, errors_list)

errors = ""
Expand Down

0 comments on commit 5533ba1

Please sign in to comment.