forked from enlightenment/efl
Pyolian: add API to get children of a unit
This commit is contained in:
parent
9a90343df2
commit
686aae5572
|
@ -332,6 +332,11 @@ class EolianBaseObject(object):
|
|||
### Main Eolian Unit ########################################################
|
||||
|
||||
class Eolian_Unit(EolianBaseObject):
|
||||
|
||||
@property
|
||||
def children(self):
|
||||
return Iterator(Eolian_Unit, lib.eolian_unit_children_get(self._obj))
|
||||
|
||||
def class_get_by_name(self, class_name):
|
||||
c_cls = lib.eolian_class_get_by_name(self._obj, _str_to_bytes(class_name))
|
||||
return Class(c_cls) if c_cls else None
|
||||
|
|
|
@ -91,6 +91,10 @@ lib.eolian_declarations_get_by_file.restype = c_void_p
|
|||
|
||||
### Eolian_Unit #############################################################
|
||||
|
||||
# EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
|
||||
lib.eolian_unit_children_get.argtypes = [c_void_p,]
|
||||
lib.eolian_unit_children_get.restype = c_void_p
|
||||
|
||||
# EAPI const Eolian_Class *eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name);
|
||||
lib.eolian_class_get_by_name.argtypes = [c_void_p, c_char_p]
|
||||
lib.eolian_class_get_by_name.restype = c_void_p
|
||||
|
|
|
@ -53,6 +53,11 @@ class TestBaseObject(unittest.TestCase):
|
|||
|
||||
|
||||
class TestEolianUnit(unittest.TestCase):
|
||||
def test_children_listing(self):
|
||||
l = list(eolian_db.children)
|
||||
self.assertGreater(len(l), 500)
|
||||
self.assertIsInstance(l[0], eolian.Eolian_Unit)
|
||||
|
||||
def test_file_listing(self):
|
||||
l = list(eolian_db.eo_file_paths)
|
||||
self.assertGreater(len(l), 400)
|
||||
|
|
Loading…
Reference in New Issue