From bb6900a54840827108c9f5d5916b6ccf6b644ada Mon Sep 17 00:00:00 2001 From: francescalb Date: Fri, 3 Nov 2023 16:04:10 +0100 Subject: [PATCH] Updated sync_reasoner to check for no relation after reasoning --- tests/ontopy_tests/test_reasoner.py | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/ontopy_tests/test_reasoner.py b/tests/ontopy_tests/test_reasoner.py index 136b69507..854202ca3 100755 --- a/tests/ontopy_tests/test_reasoner.py +++ b/tests/ontopy_tests/test_reasoner.py @@ -7,33 +7,44 @@ from ontopy.ontology import Ontology -def test_sync_reasoner_hermit() -> None: +def test_sync_reasoner_hermit(repo_dir: "Path") -> None: """Test `ontopy:Ontology.sync_reasoner()` with HermiT.""" from ontopy import get_ontology - testonto = get_ontology("../testonto/testonto_for_reasoner.ttl") - print(testonto) + testonto = get_ontology( + repo_dir / "tests" / "testonto" / "testonto_for_reasoner.ttl" + ).load() + assert testonto.Avocado + assert not isinstance(testonto.Avocado, testonto.NaturalDye) testonto.sync_reasoner(reasoner="HermiT") + assert isinstance(testonto.Avocado, testonto.NaturalDye) -def test_sync_reasoner_pellet() -> None: +def test_sync_reasoner_pellet(repo_dir: "Path") -> None: """Test `ontopy:Ontology.sync_reasoner()` with Pellet""" from ontopy import get_ontology - testonto = get_ontology("../testonto/testonto_for_reasoner.ttl") - print(testonto) + testonto = get_ontology( + repo_dir / "tests" / "testonto" / "testonto_for_reasoner.ttl" + ).load() + assert testonto.Avocado + assert not isinstance(testonto.Avocado, testonto.NaturalDye) testonto.sync_reasoner(reasoner="Pellet") + assert isinstance(testonto.Avocado, testonto.NaturalDye) -def test_sync_reasoner_fact() -> None: +def test_sync_reasoner_fact(repo_dir: "Path") -> None: """Test `ontopy:Ontology.sync_reasoner()` with FaCT++""" from ontopy import get_ontology - testonto = get_ontology("../testonto/testonto_for_reasoner.ttl") - print(testonto) - + testonto = get_ontology( + repo_dir / "tests" / "testonto" / "testonto_for_reasoner.ttl" + ).load() + assert testonto.Avocado + assert not isinstance(testonto.Avocado, testonto.NaturalDye) testonto.sync_reasoner(reasoner="FaCT++") + assert isinstance(testonto.Avocado, testonto.NaturalDye) def test_sync_reasoner_wrong(testonto: "Ontology") -> None: