Skip to content

Commit

Permalink
Add test for askenet n-way comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris authored and bgyori committed Jul 12, 2023
1 parent 3679f3a commit 451b9af
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_model_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,41 @@ def test_counts_to_dimensionless_amr(self):

for initial in tm_dimless.initials.values():
assert initial.concept.units.expression.args[0].equals(1)

def test_n_way_comparison_askenet(self):
sir_parameterized_ctx = TemplateModel(
templates=[
t.with_context(location="geonames:5128581")
for t in sir_parameterized.templates
]
)
askenet_list = []
for sp in [sir_parameterized, sir_parameterized_ctx]:
askenet_list.append(
AskeNetPetriNetModel(Model(sp)).to_json()
)

response = self.client.post(
"/api/askenet_model_comparison",
json={"petrinet_models": askenet_list},
)
self.assertEqual(200, response.status_code)

# See if the response json can be parsed with ModelComparisonResponse
resp_model = ModelComparisonResponse(**response.json())

# Check that the response is the same as the local version
# explicitly don't use TemplateModelComparison.from_template_models
local = TemplateModelComparison(
template_models=[sir_parameterized, sir_parameterized_ctx],
refinement_func=is_ontological_child_web
)
model_comparson_graph_data = local.model_comparison
local_response = ModelComparisonResponse(
graph_comparison_data=model_comparson_graph_data,
similarity_scores=model_comparson_graph_data.get_similarity_scores(),
)
self.assertEqual(
sorted_json_str(local_response.dict()),
sorted_json_str(resp_model.dict()),
)

0 comments on commit 451b9af

Please sign in to comment.