Repository: biolink/biolink-model-toolkit

Issue:
Inconsistent return values from `get_descendants` method
When asking for a descendant, if descendants exist the method will return a list with the original category in it:
```python
from bmt import Toolkit
t = Toolkit()
print( t.get_descendants("disease or phenotypic feature") )
```
prints out `['disease or phenotypic feature', 'disease', 'phenotypic feature']`

However, when doing the same thing with an object with no descendants, an empty list is returned:

```python
from bmt import Toolkit
t = Toolkit()
print( t.get_descendants("disease") )
```
prints out `[]`

This should either print out `['disease']` OR the above call should print out `['disease', 'phenotypic feature']` for consistency.

Discussion:

Patch:
diff --git a/bmt/toolkit.py b/bmt/toolkit.py
index 514cde9..15baef7 100644
--- a/bmt/toolkit.py
+++ b/bmt/toolkit.py
@@ -304,7 +304,7 @@ class Toolkit(object):
         element = self.get_element(name)
         if element:
             d = self.generator.descendants(element.name)
-            if d and reflexive:
+            if reflexive:
                 desc.append(element.name)
             desc += d
             if isinstance(element, SlotDefinition):


Test patch:
diff --git a/tests/unit/test_toolkit.py b/tests/unit/test_toolkit.py
index 272c473..a602db1 100644
--- a/tests/unit/test_toolkit.py
+++ b/tests/unit/test_toolkit.py
@@ -137,6 +137,8 @@ def test_descendants():
     assert 'molecular activity_has output' not in toolkit.get_descendants('molecular activity', reflexive=True)
     assert 'molecular activity_has output' not in toolkit.get_descendants('has output', reflexive=True)
 
+    assert 'gene' in toolkit.get_descendants('gene', reflexive=True)
+
 
 def test_children():
     toolkit = Toolkit()