Skip to content

Commit

Permalink
Add test_godag_ecs() per #292
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed May 5, 2024
1 parent f21c24c commit 2f8e5cb
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions tests/test_get_godag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@
import sys
from goatools.base import get_godag


def test_godag(prt=sys.stdout):
"""Test downloading GO DAG."""
"""
Test downloading GO DAG.
"""
cwd = os.getcwd()
for fin_obo in ['go-basic.obo', 'goslim_generic.obo']:
for fin_obo in ["go-basic.obo", "goslim_generic.obo"]:
fin_full = os.path.join(cwd, fin_obo)
os.system("rm -f {OBO}".format(OBO=fin_obo))
godag = get_godag(fin_full, prt, loading_bar=None) # Get GODag object
godag = get_godag(fin_full, prt, loading_bar=None) # Get GODag object
assert godag, "GO-DAG({OBO}) NOT PROPERLY LOADED".format(OBO=fin_obo)

if __name__ == '__main__':

def test_godag_ecs():
"""
Test downloading GO DAG and extract ECs.
"""
godag = get_godag("go-basic.obo", optional_attrs="xref")
go = godag["GO:0000010"]
ecs = [x for x in go.xref if x.startswith("EC:")]
assert "EC:2.5.1.30" in ecs


if __name__ == "__main__":
test_godag()
test_godag_ecs()

0 comments on commit 2f8e5cb

Please sign in to comment.