-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 406-harmonize-get_descendants-and-get_ance…
…stors
- Loading branch information
Showing
5 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pre-commit>=2.21.0,<3; python_version<"3.8" | ||
pre-commit~=3.2; python_version>="3.8" | ||
pre-commit~=3.3; python_version>="3.8" | ||
pylint~=2.17 | ||
pytest~=7.3 | ||
pytest-cov~=4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
"""Tests Owlready2 patches implemented in ontopy/patch.py | ||
Implemented as a script, such that it easy to understand and use for debugging. | ||
""" | ||
from ontopy import get_ontology | ||
|
||
from owlready2 import owl, Inverse | ||
|
||
|
||
emmo = get_ontology().load() | ||
|
||
|
||
# Test some ThingClass extensions implemented in patch.py | ||
assert emmo.Atom.get_preferred_label() == "Atom" | ||
|
||
assert emmo.Atom.get_parents() == { | ||
emmo.CausalSystem, | ||
emmo.CompositeParticle, | ||
emmo.MolecularEntity, | ||
} | ||
|
||
assert set(emmo.Atom.get_annotations().keys()) == { | ||
"prefLabel", | ||
"altLabel", | ||
"elucidation", | ||
} | ||
|
||
# TODO: Fix disjoint_with(). | ||
# It seems not to take into account disjoint unions. | ||
# assert set(emmo.Collection.disjoint_with()) == {emmo.Item} | ||
|
||
assert set(str(s) for s in emmo.CausalChain.get_indirect_is_a()) == set( | ||
str(s) | ||
for s in { | ||
Inverse(emmo.hasPart).value(emmo.universe), | ||
emmo.CausalObject, | ||
emmo.Particle, | ||
emmo.hasPart.some(emmo.Quantum), | ||
emmo.hasTemporalPart.only(emmo.CausalChain | emmo.Quantum), | ||
emmo.hasTemporalPart.some(emmo.CausalChain | emmo.Quantum), | ||
} | ||
) | ||
assert set( | ||
str(s) for s in emmo.CausalChain.get_indirect_is_a(skip_classes=False) | ||
) == set( | ||
str(s) | ||
for s in { | ||
Inverse(emmo.hasPart).value(emmo.universe), | ||
emmo.CausalObject, | ||
emmo.EMMO, | ||
emmo.Item, | ||
emmo.Particle, | ||
emmo.hasPart.some(emmo.Quantum), | ||
emmo.hasTemporalPart.only(emmo.CausalChain | emmo.Quantum), | ||
emmo.hasTemporalPart.some(emmo.CausalChain | emmo.Quantum), | ||
owl.Thing, | ||
} | ||
) | ||
|
||
assert emmo.Atom.is_defined == False | ||
assert emmo.Holistic.is_defined == True |