diff --git a/tests/test_ontology.py b/tests/test_ontology.py index b9d6500..10e988e 100644 --- a/tests/test_ontology.py +++ b/tests/test_ontology.py @@ -1,11 +1,20 @@ +from pathlib import Path + import bionty.base as bt_base from bionty.base.dev._io import s3_bionty_assets def test_ontology(): localpath = s3_bionty_assets("ontology_all__pw__7.79__Pathway") - onto = bt_base.Ontology(localpath) - assert onto.get_term("PW:0000014").name == "neurodegenerative pathway" - df = onto.to_df(source="pw", include_id_prefixes={"pw": ["PW"]}) - assert df.shape == (2647, 4) - assert df.index.name == "ontology_id" + + try: + onto = bt_base.Ontology(localpath) + assert onto.get_term("PW:0000014").name == "neurodegenerative pathway" + + df = onto.to_df(source="pw", include_id_prefixes={"pw": ["PW"]}) + assert df.shape == (2647, 4) + assert df.index.name == "ontology_id" + + finally: + if Path(localpath).exists: + Path(localpath).unlink()