diff --git a/goatools/__init__.py b/goatools/__init__.py index 1da4e38..3a332cd 100644 --- a/goatools/__init__.py +++ b/goatools/__init__.py @@ -1,23 +1,23 @@ from datetime import datetime -from pkg_resources import get_distribution, DistributionNotFound +from importlib.metadata import version, PackageNotFoundError __author__ = ("Haibao Tang", "DV Klopfenstein") -__copyright__ = "Copyright (C) 2009-{}, Haibao Tang, DV Klopfenstein".format( - datetime.now().year +__copyright__ = ( + f"Copyright (C) 2009-{datetime.now().year}, Haibao Tang, DV Klopfenstein" ) __email__ = "tanghaibao@gmail.com" __license__ = "BSD" __status__ = "Development" try: - VERSION = get_distribution(__name__).version -except DistributionNotFound: # pragma: no cover + VERSION = version(__name__) +except PackageNotFoundError: # pragma: no cover try: from .version import version as VERSION # noqa - except ImportError: # pragma: no cover + except ImportError as exc: # pragma: no cover raise ImportError( "Failed to find (autogenerated) version.py. " "This might be because you are installing from GitHub's tarballs, " "use the PyPI ones." - ) + ) from exc __version__ = VERSION diff --git a/tests/test_i304_regulates.py b/tests/test_i304_regulates.py new file mode 100644 index 0000000..1ea0389 --- /dev/null +++ b/tests/test_i304_regulates.py @@ -0,0 +1,15 @@ +from goatools.gosubdag.gosubdag import GoSubDag +from goatools.obo_parser import GODag + + +def test_i304_regulates(): + godag = GODag("go-basic.obo", optional_attrs=["relationship"]) + optional_relationships = { + "regulates", + "negatively_regulates", + "positively_regulates", + } + anc = GoSubDag( + ["GO:0019222"], godag, optional_relationships, prt=None + ).rcntobj.go2ancestors["GO:0019222"] + assert len(anc) == 4