summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-07-15 15:12:28 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-16 00:46:56 -0300
commit0a9441da1587def343dd1ab9b1c9c1b2a614df86 (patch)
tree0a7e6eb63ab01916be3b215f5833c16ddfe22eb5
parent1e7ec9dd16fe808400550f68fc69293ff2623bee (diff)
pyolian: Add a method to get the hierarchy of extensions
Summary: To be used by the test generator Depends on D10420 Test Plan: test in the diff Reviewers: DaveMDS, herb, segfaultxavi Subscribers: cedric, brunobelo, #reviewers, felipealmeida, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10421
-rw-r--r--src/scripts/pyolian/eolian.py17
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py8
2 files changed, 25 insertions, 0 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 31f4f06f44..eababfadba 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -733,6 +733,23 @@ class Class(Object):
733 return Iterator(Class, lib.eolian_class_extensions_get(self)) 733 return Iterator(Class, lib.eolian_class_extensions_get(self))
734 734
735 @cached_property 735 @cached_property
736 def extensions_hierarchy(self):
737 visited = set()
738 queue = [ext for ext in self.extensions]
739
740 while queue:
741 current = queue.pop()
742
743 if current in visited:
744 continue
745
746 visited.add(current)
747
748 queue.extend(current.extensions)
749
750 return visited
751
752 @cached_property
736 def inherits_full(self): 753 def inherits_full(self):
737 li = [] 754 li = []
738 755
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index b6090c661e..133b279084 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -704,3 +704,11 @@ class TestEolianInherits(object):
704 def test_inherits_full(self, eolian_db): 704 def test_inherits_full(self, eolian_db):
705 cls = eolian_db.class_by_name_get('Efl.Ui.Widget') 705 cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
706 assert 'Efl.Object' in cls.inherits_full 706 assert 'Efl.Object' in cls.inherits_full
707
708 def test_extensions_hierarchy(self, eolian_db):
709 cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
710
711 # inherited extension
712 assert any(x.name == 'Efl.Gfx.Stack' for x in cls.extensions_hierarchy)
713 # direct extension
714 assert any(x.name == 'Efl.Access.Object' for x in cls.extensions_hierarchy)