def list_entities(cls): """Search for all instance of Entity, which correspond to all existing rules installed """ subs = classes.list_subclasses(cls, __name__, __path__) result = collections.defaultdict(dict) for sub in subs: result[sub.library][sub.name] = sub return result
def test_list_subclasses(self): subclasses = classes.list_subclasses( BaseClass, test.__name__, test.__path__) class_names = [subclass.__name__ for subclass in subclasses] for expected in ('SubclassA', 'SubclassB', 'SubclassC'): self.assertIn(expected, class_names)