Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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)