Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing test #741

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions tests/test_get_by_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,22 @@ def test_get_by_label_emmo(emmo: "Ontology") -> None:
from emmopy import get_emmo
from ontopy import get_ontology
from ontopy.ontology import NoSuchLabelError
from ontopy.testutils import ontodir

emmo = get_emmo()
assert emmo[emmo.Atom.name] == emmo.Atom
assert emmo[emmo.Atom.iri] == emmo.Atom

# Load an ontology with imported sub-ontologies
onto = get_ontology(
"https://raw.githubusercontent.com/BIG-MAP/BattINFO/master/battinfo.ttl"
).load()
assert onto.Electrolyte.prefLabel.en.first() == "Electrolyte"
# XXX: doesn't work at the moment
# onto = get_ontology("https://w3id.org/emmo/domain/battery").load()
# assert onto.Electrolyte.prefLabel.en.first() == "Electrolyte"
onto = get_ontology(ontodir / "testonto.ttl").load()
assert onto.TestClass.prefLabel.en.first() == "TestClass"

# Check colon_in_name argument
onto.Atom.altLabel.append("Element:X")
emmo.Atom.altLabel.append("Element:X")
with pytest.raises(NoSuchLabelError):
onto.get_by_label("Element:X")
emmo.get_by_label("Element:X")

assert onto.get_by_label("Element:X", colon_in_label=True) == onto.Atom
assert emmo.get_by_label("Element:X", colon_in_label=True) == emmo.Atom
14 changes: 9 additions & 5 deletions tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ def test_load(repo_dir: "Path", testonto: "Ontology") -> None:
assert str(testonto.TestClass.prefLabel.first()) == "TestClass"

# Use catalog file when downloading from web
onto = get_ontology(
"https://raw.githubusercontent.com/BIG-MAP/BattINFO/master/"
"battinfo.ttl"
).load()
assert str(onto.Electrolyte.prefLabel.first()) == "Electrolyte"

# ------------------------------------
# Commented out because battinfo currenly doesn't load
# onto = get_ontology(
# "https://raw.githubusercontent.com/BIG-MAP/BattINFO/master/"
# "battinfo.ttl"
# ).load()
# assert str(onto.Electrolyte.prefLabel.first()) == "Electrolyte"
# ------------------------------------

with pytest.raises(
EMMOntoPyException,
Expand Down
Loading