From 05da0089463ded460e6154b81beb69cf6110b48e Mon Sep 17 00:00:00 2001 From: muddymudskipper Date: Thu, 27 Jun 2024 12:07:57 +0100 Subject: [PATCH] edit tests and version number --- pyproject.toml | 4 ++-- tests/test_reason.py | 26 ++++++++++++-------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e1e2cf7..30c809b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cmem-plugin-reason" -version = "0.0.0" +version = "1.0.0alpha1" license = "Apache-2.0" description = "Reasoning with Robot" authors = ["eccenca GmbH "] @@ -13,7 +13,7 @@ readme = "README-public.md" keywords = [ "eccenca Corporate Memory", "plugin" ] -include = ["cmem_plugin_reason/bin/*"] +include = ["cmem_plugin_reason/bin/robot.jar"] homepage = "https://github.com/eccenca/cmem-plugin-reason" diff --git a/tests/test_reason.py b/tests/test_reason.py index 79d2cf8..631c093 100644 --- a/tests/test_reason.py +++ b/tests/test_reason.py @@ -59,6 +59,16 @@ def _setup(request: pytest.FixtureRequest) -> None: def tests(_setup: None) -> None: """Tests for reason plugin""" + def get_remote_graph(iri: str) -> Graph: + graph = Graph().parse( + data=get(iri, owl_imports_resolution=False).text, + format="turtle", + ) + graph.remove((URIRef(iri), DCTERMS.created, None)) + graph.remove((URIRef(iri), RDFS.label, None)) + graph.remove((None, RDF.type, OWL.AnnotationProperty)) + return graph + def test_reasoner(reasoner: str, err_list: list) -> list: ReasonPlugin( data_graph_iri=REASON_DATA_GRAPH_IRI, @@ -70,14 +80,7 @@ def test_reasoner(reasoner: str, err_list: list) -> list: property_assertion=True, ).execute((), context=TestExecutionContext()) - result = Graph().parse( - data=get(REASON_RESULT_GRAPH_IRI, owl_imports_resolution=False).text, - format="turtle", - ) - result.remove((URIRef(REASON_RESULT_GRAPH_IRI), DCTERMS.created, None)) - result.remove((URIRef(REASON_RESULT_GRAPH_IRI), RDFS.label, None)) - result.remove((None, RDF.type, OWL.AnnotationProperty)) - + result = get_remote_graph(REASON_RESULT_GRAPH_IRI) test = Graph().parse(Path(__path__[0]) / f"test_{reasoner}.ttl", format="turtle") if to_isomorphic(result) != to_isomorphic(test): err_list.append(reasoner) @@ -99,12 +102,7 @@ def test_validate(errors: str) -> str: if not cmp(MD_FILENAME, mdfile_test): errors += "Markdown file error ." - output_graph = Graph().parse( - data=get(OUTPUT_GRAPH_IRI, owl_imports_resolution=False).text, - ) - output_graph.remove((URIRef(OUTPUT_GRAPH_IRI), DCTERMS.created, None)) - output_graph.remove((URIRef(OUTPUT_GRAPH_IRI), RDFS.label, None)) - output_graph.remove((None, RDF.type, OWL.AnnotationProperty)) + output_graph = get_remote_graph(OUTPUT_GRAPH_IRI) test = Graph().parse(Path(__path__[0]) / "test_validate_output.ttl", format="turtle") if to_isomorphic(output_graph) != to_isomorphic(test): errors += "Output graph error. "