forked from enlightenment/efl
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, felipealmeida Reviewed By: felipealmeida Subscribers: cedric, brunobelo, #reviewers, felipealmeida, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10421
This commit is contained in:
parent
0acc840f19
commit
abaa90cfc2
|
@ -732,6 +732,23 @@ class Class(Object):
|
||||||
def extensions(self):
|
def extensions(self):
|
||||||
return Iterator(Class, lib.eolian_class_extensions_get(self))
|
return Iterator(Class, lib.eolian_class_extensions_get(self))
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def extensions_hierarchy(self):
|
||||||
|
visited = set()
|
||||||
|
queue = [ext for ext in self.extensions]
|
||||||
|
|
||||||
|
while queue:
|
||||||
|
current = queue.pop()
|
||||||
|
|
||||||
|
if current in visited:
|
||||||
|
continue
|
||||||
|
|
||||||
|
visited.add(current)
|
||||||
|
|
||||||
|
queue.extend(current.extensions)
|
||||||
|
|
||||||
|
return visited
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def inherits_full(self):
|
def inherits_full(self):
|
||||||
li = []
|
li = []
|
||||||
|
|
|
@ -704,3 +704,11 @@ class TestEolianInherits(object):
|
||||||
def test_inherits_full(self, eolian_db):
|
def test_inherits_full(self, eolian_db):
|
||||||
cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
|
cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
|
||||||
assert 'Efl.Object' in cls.inherits_full
|
assert 'Efl.Object' in cls.inherits_full
|
||||||
|
|
||||||
|
def test_extensions_hierarchy(self, eolian_db):
|
||||||
|
cls = eolian_db.class_by_name_get('Efl.Ui.Widget')
|
||||||
|
|
||||||
|
# inherited extension
|
||||||
|
assert any(x.name == 'Efl.Gfx.Stack' for x in cls.extensions_hierarchy)
|
||||||
|
# direct extension
|
||||||
|
assert any(x.name == 'Efl.Access.Object' for x in cls.extensions_hierarchy)
|
||||||
|
|
Loading…
Reference in New Issue