Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
graph-validation-tests expected output format tweaked slightly
Browse files Browse the repository at this point in the history
RichardBruskiewich committed Apr 25, 2024

Verified

This commit was signed with the committer’s verified signature.
dmitryax Dmitrii Anoshin
1 parent 66064df commit 353348d
Showing 2 changed files with 101 additions and 241 deletions.
10 changes: 3 additions & 7 deletions test_harness/run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Run tests through the Test Runners."""
from typing import Optional, Tuple, List, Dict
from typing import Optional, List, Dict
from collections import defaultdict
import httpx
import json
@@ -11,10 +11,8 @@
from translator_testing_model.datamodel.pydanticmodel import (
TestAsset,
TestCase,
TestObjectiveEnum,
TestEnvEnum,
ComponentEnum,
TestCaseResultEnum
ComponentEnum
)

from ARS_Test_Runner.semantic_test import run_semantic_test as run_ars_test
@@ -414,9 +412,7 @@ async def run_tests(
try:
labels: List[Dict[str, str]] = list()
for component, result in test_case_results.items():
# TODO: maybe the 'graph-validation-tests' TestRunners should
# rather return a Dict with result["status"], not a Tuple?
status: str = result[0] if isinstance(result, Tuple) else result
status: str = result["status"] if "status" in result else "PASSED"
# TODO: unsure if the status should be counted here (with respect to the test cases?)
# or whether it should be tallied somewhere else
full_report[status] += 1
332 changes: 98 additions & 234 deletions tests/example_test_outputs.py
Original file line number Diff line number Diff line change
@@ -3,262 +3,126 @@
"""

example_one_hops_test_output = {
"pks": [
"arax",
"molepro"
],
"results": [
[
{
"arax": {
"by_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
},
{
"arax": {
"inverse_by_new_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {},
"critical": {
"critical.trapi.response.unexpected_http_code": {
"global": {
"400": None
}
}
"pks": {
"arax": "arax",
"molepro": "molepro"
},
"results": {
"TestAsset_1-by_subject": {
"molepro": {
"status": "PASSED",
"messages": {
"info": {
"info.compliant": {
"global": None
}
}
}
},
{
"arax": {
"by_object": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
},
{
"arax": {
"raise_subject_entity": {
"info": {},
"skipped": {},
"warning": {},
"error": {},
"critical": {
"critical.trapi.request.invalid": {
"global": {
"subject 'DRUGBANK:DB01592[biolink:SmallMolecule]'": [
{
"context": "raise_subject_entity",
"reason": "has no 'is_a' parent since it is either not an ontology term or does not map onto a parent ontology term."
}
]
}
}
},
"TestAsset_1-inverse_by_new_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"critical": {
"critical.trapi.request.invalid": {
"global": {
"predicate 'biolink:is_active_metabolite_of'": [
{
"context": "inverse_by_new_subject",
"reason": "is an unknown or has no inverse?"
}
]
}
}
}
}
},
{
"arax": {
"raise_object_entity": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
},
{
"arax": {
"raise_object_by_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
},
{
"arax": {
"raise_predicate_by_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
}
],
[
{
"molepro": {
"by_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
},
{
"molepro": {
"inverse_by_new_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
},
"TestAsset_1-by_object": {
"molepro": {
"status": "FAILED",
"messages": {
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset_1|(CHEBI:58579#biolink:SmallMolecule)-[biolink:is_active_metabolite_of]->(UniProtKB:Q9NQ88#biolink:Protein)": None
}
},
"critical": {}
}
}
},
{
"molepro": {
"by_object": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"critical": {}
}
}
}
},
{
"molepro": {
"raise_subject_entity": {
"info": {},
"skipped": {},
"warning": {},
"error": {},
"critical": {
"critical.trapi.request.invalid": {
"global": {
"subject 'DRUGBANK:DB01592[biolink:SmallMolecule]'": [
{
"context": "raise_subject_entity",
"reason": "has no 'is_a' parent since it is either not an ontology term or does not map onto a parent ontology term."
}
]
}
}
},
"TestAsset_1-raise_subject_entity": {
"molepro": {
"status": "FAILED",
"messages": {
"critical": {
"critical.trapi.request.invalid": {
"global": {
"subject 'CHEBI:58579[biolink:SmallMolecule]'": [
{
"context": "raise_subject_entity",
"reason": "has no 'is_a' parent since it is either not an ontology term or does not map onto a parent ontology term."
}
]
}
}
}
}
},
{
"molepro": {
"raise_object_entity": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"TestAsset_1-raise_object_entity": {
"molepro": {
"status": "FAILED",
"messages": {
"critical": {
"critical.trapi.request.invalid": {
"global": {
"object 'UniProtKB:Q9NQ88[biolink:Protein]'": [
{
"context": "raise_object_entity",
"reason": "has no 'is_a' parent since it is either not an ontology term or does not map onto a parent ontology term."
}
]
}
},
"critical": {}
}
}
}
},
{
"molepro": {
"raise_object_by_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"TestAsset_1-raise_object_by_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset_1|(CHEBI:58579#biolink:SmallMolecule)-[biolink:is_active_metabolite_of]->(UniProtKB:Q9NQ88#biolink:Protein)": None
}
},
"critical": {}
}
}
}
},
{
"molepro": {
"raise_predicate_by_subject": {
"info": {},
"skipped": {},
"warning": {},
"error": {
"error.trapi.response.knowledge_graph.missing_expected_edge": {
"global": {
"TestAsset:00001|(DRUGBANK:DB01592#biolink:SmallMolecule)-[biolink:has_side_effect]->(MONDO:0011426#biolink:Disease)": None
}
}
},
"TestAsset_1-raise_predicate_by_subject": {
"molepro": {
"status": "FAILED",
"messages": {
"critical": {
"critical.trapi.request.invalid": {
"global": {
"predicate 'biolink:is_active_metabolite_of'": [
{
"context": "raise_predicate_by_subject",
"reason": "has no 'is_a' parent"
}
]
}
},
"critical": {}
}
}
}
}
]
]
}
}
}
}

0 comments on commit 353348d

Please sign in to comment.