summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Lira <larry@expertisesolutions.com.br>2018-09-12 15:22:11 -0300
committerLarry Lira <larry@expertisesolutions.com.br>2018-09-12 15:22:11 -0300
commit4af27ffd9da448333309baa6817f042815d9e305 (patch)
tree21284c6223dd952c1665d3787bb11d8142a2da50
parentb582eca357456d1c4a7bbdcfd2ad794212bd8735 (diff)
testgen: test inherits functions
- added inherits methods and properties in functions list test
-rw-r--r--src/scripts/testgen/suitegen.py50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/scripts/testgen/suitegen.py b/src/scripts/testgen/suitegen.py
index 8527aa88e8..83458e0a0b 100644
--- a/src/scripts/testgen/suitegen.py
+++ b/src/scripts/testgen/suitegen.py
@@ -34,17 +34,13 @@ class ComItem(BaseItem):
34class FuncItem(ComItem): 34class FuncItem(ComItem):
35 def __init__(self, comp, path, keys): 35 def __init__(self, comp, path, keys):
36 super().__init__(comp, os.path.join(path, comp.name), keys) 36 super().__init__(comp, os.path.join(path, comp.name), keys)
37 37 has = (
38 self.has_getter = ( 38 lambda f, p, s, bl: f.getter_scope == f.getter_scope.PUBLIC
39 comp.getter_scope == comp.getter_scope.PUBLIC 39 and f.full_c_getter_name not in bl
40 and comp.full_c_getter_name not in self.keys.blacklist 40 and not os.path.isfile("{}_{}".format(os.path.join(p, f.name), s))
41 and not os.path.isfile("{}_get".format(os.path.join(path, comp.name)))
42 )
43 self.has_setter = (
44 comp.setter_scope == comp.setter_scope.PUBLIC
45 and comp.full_c_setter_name not in self.keys.blacklist
46 and not os.path.isfile("{}_set".format(os.path.join(path, comp.name)))
47 ) 41 )
42 self.has_getter = has(comp, path, "get", keys.blacklist)
43 self.has_setter = has(comp, path, "set", keys.blacklist)
48 44
49 @property 45 @property
50 def format_name(self): 46 def format_name(self):
@@ -59,37 +55,35 @@ class ClassItem(ComItem):
59 self.myname = os.path.splitext(comp.file)[0] 55 self.myname = os.path.splitext(comp.file)[0]
60 super().__init__(comp, os.path.join(path, self.myname), keys) 56 super().__init__(comp, os.path.join(path, self.myname), keys)
61 57
58 mfilter = (
59 lambda f: f.full_c_method_name not in self.keys.blacklist
60 and not os.path.isfile(os.path.join(self.path, f.name))
61 )
62
62 self.methods = [ 63 self.methods = [
63 FuncItem(m, self.path, keys) 64 FuncItem(m, self.path, keys) for m in filter(mfilter, self.comp.methods)
64 for m in self.comp.methods
65 if m.full_c_method_name not in self.keys.blacklist
66 and not os.path.isfile(os.path.join(self.path, m.name))
67 ] 65 ]
68
69 self._properties = [ 66 self._properties = [
70 FuncItem(p, self.path, keys) 67 FuncItem(p, self.path, keys) for p in filter(mfilter, self.comp.properties)
71 for p in self.comp.properties
72 if p.full_c_method_name not in self.keys.blacklist
73 and not os.path.isfile(os.path.join(self.path, p.name))
74 ] 68 ]
75 69
70 for eoclass in comp.inherits_full:
71 for f in filter(mfilter, eoclass.methods):
72 self.methods.append(FuncItem(f, self.path, keys))
73 for f in filter(mfilter, eoclass.properties):
74 self._properties.append(FuncItem(f, self.path, keys))
75
76 @property 76 @property
77 def properties(self): 77 def properties(self):
78 return itertools.filterfalse( 78 return filter(lambda p: p.has_setter or p.has_getter, self._properties)
79 lambda p: not (p.has_setter or p.has_getter), self._properties
80 )
81 79
82 @property 80 @property
83 def properties_get(self): 81 def properties_get(self):
84 return itertools.filterfalse( 82 return filter(lambda p: p.has_getter, self._properties)
85 lambda p: not p.has_getter, self._properties
86 )
87 83
88 @property 84 @property
89 def properties_set(self): 85 def properties_set(self):
90 return itertools.filterfalse( 86 return filter(lambda p: p.has_setter, self._properties)
91 lambda p: not p.has_setter, self._properties
92 )
93 87
94 def __iter__(self): 88 def __iter__(self):
95 return itertools.chain(self.methods, self.properties) 89 return itertools.chain(self.methods, self.properties)