forked from enlightenment/efl
Pyolian: reformat code to make pycharm happy
and fix some typos in the code
This commit is contained in:
parent
a864d62ecf
commit
d1e27aacfc
|
@ -35,8 +35,8 @@ except ImportError:
|
|||
|
||||
_already_halted = False
|
||||
|
||||
### Eolian Enums ############################################################
|
||||
|
||||
# Eolian Enums ##############################################################
|
||||
class Eolian_Function_Type(IntEnum):
|
||||
UNRESOLVED = 0
|
||||
PROPERTY = 1
|
||||
|
@ -45,12 +45,14 @@ class Eolian_Function_Type(IntEnum):
|
|||
METHOD = 4
|
||||
FUNCTION_POINTER = 5
|
||||
|
||||
|
||||
class Eolian_Parameter_Direction(IntEnum):
|
||||
UNKNOWN = 0
|
||||
IN = 1
|
||||
OUT = 2
|
||||
INOUT = 3
|
||||
|
||||
|
||||
class Eolian_Class_Type(IntEnum):
|
||||
UNKNOWN_TYPE = 0
|
||||
REGULAR = 1
|
||||
|
@ -58,12 +60,14 @@ class Eolian_Class_Type(IntEnum):
|
|||
MIXIN = 3
|
||||
INTERFACE = 4
|
||||
|
||||
|
||||
class Eolian_Object_Scope(IntEnum):
|
||||
UNKNOWN = 0
|
||||
PUBLIC = 1
|
||||
PRIVATE = 2
|
||||
PROTECTED = 3
|
||||
|
||||
|
||||
class Eolian_Typedecl_Type(IntEnum):
|
||||
UNKNOWN = 0
|
||||
STRUCT = 1
|
||||
|
@ -72,6 +76,7 @@ class Eolian_Typedecl_Type(IntEnum):
|
|||
ALIAS = 4
|
||||
FUNCTION_POINTER = 5
|
||||
|
||||
|
||||
class Eolian_Type_Type(IntEnum):
|
||||
UNKNOWN_TYPE = 0
|
||||
VOID = 1
|
||||
|
@ -79,6 +84,7 @@ class Eolian_Type_Type(IntEnum):
|
|||
CLASS = 3
|
||||
UNDEFINED = 4
|
||||
|
||||
|
||||
class Eolian_Type_Builtin_Type(IntEnum):
|
||||
INVALID = 0
|
||||
BYTE = 1
|
||||
|
@ -141,6 +147,7 @@ class Eolian_Type_Builtin_Type(IntEnum):
|
|||
HASH = 47
|
||||
VOID_PTR = 48
|
||||
|
||||
|
||||
class Eolian_Expression_Type(IntEnum):
|
||||
UNKNOWN = 0
|
||||
INT = 1
|
||||
|
@ -159,6 +166,7 @@ class Eolian_Expression_Type(IntEnum):
|
|||
UNARY = 14
|
||||
BINARY = 15
|
||||
|
||||
|
||||
class Eolian_Expression_Mask(IntEnum):
|
||||
SINT = 1 << 0
|
||||
UINT = 1 << 1
|
||||
|
@ -172,6 +180,7 @@ class Eolian_Expression_Mask(IntEnum):
|
|||
NUMBER = INT | FLOAT
|
||||
ALL = NUMBER | BOOL | STRING | CHAR | NULL
|
||||
|
||||
|
||||
class Eolian_Binary_Operator(IntEnum):
|
||||
INVALID = 0
|
||||
ADD = 1 # + int, float
|
||||
|
@ -193,6 +202,7 @@ class Eolian_Binary_Operator(IntEnum):
|
|||
LSH = 17 # << int
|
||||
RSH = 18 # >> int
|
||||
|
||||
|
||||
class Eolian_Unary_Operator(IntEnum):
|
||||
INVALID = 0
|
||||
UNM = 1 # - sint
|
||||
|
@ -200,6 +210,7 @@ class Eolian_Unary_Operator(IntEnum):
|
|||
NOT = 3 # ! int, float, bool
|
||||
BNOT = 4 # ~ int
|
||||
|
||||
|
||||
class Eolian_Doc_Token_Type(IntEnum):
|
||||
UNKNOWN = 0
|
||||
TEXT = 1
|
||||
|
@ -211,7 +222,7 @@ class Eolian_Doc_Token_Type(IntEnum):
|
|||
MARKUP_MONOSPACE = 7
|
||||
|
||||
|
||||
### internal Classes ########################################################
|
||||
# Internal Classes ##########################################################
|
||||
|
||||
class Iterator(object):
|
||||
""" Generic eina iterator wrapper """
|
||||
|
@ -251,6 +262,7 @@ class cached_property(object):
|
|||
|
||||
class EolianBaseObject(object):
|
||||
__instances_cache = {}
|
||||
|
||||
def __new__(cls, c_obj_pointer=None, *args, **kargs):
|
||||
# cannot cache without a pointer
|
||||
if c_obj_pointer is None:
|
||||
|
@ -307,7 +319,7 @@ class EolianBaseObject(object):
|
|||
return self._obj
|
||||
|
||||
|
||||
### Main Eolian Unit ########################################################
|
||||
# Main Eolian Unit ##########################################################
|
||||
|
||||
class Eolian_Unit(EolianBaseObject):
|
||||
def __repr__(self):
|
||||
|
@ -474,7 +486,7 @@ class Eolian_State(Eolian_Unit):
|
|||
lib.eolian_state_enums_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
|
||||
### Namespace Utility Class #################################################
|
||||
# Namespace Utility Class ###################################################
|
||||
|
||||
class Namespace(object):
|
||||
def __init__(self, unit, namespace_name):
|
||||
|
@ -523,26 +535,26 @@ class Namespace(object):
|
|||
@property
|
||||
def regulars(self):
|
||||
return sorted([c for c in self._unit.classes
|
||||
if c.type == Eolian_Class_Type.REGULAR and
|
||||
c.namespace == self._name])
|
||||
if c.type == Eolian_Class_Type.REGULAR
|
||||
and c.namespace == self._name])
|
||||
|
||||
@property
|
||||
def abstracts(self):
|
||||
return sorted([c for c in self._unit.classes
|
||||
if c.type == Eolian_Class_Type.ABSTRACT and
|
||||
c.namespace == self._name])
|
||||
if c.type == Eolian_Class_Type.ABSTRACT
|
||||
and c.namespace == self._name])
|
||||
|
||||
@property
|
||||
def mixins(self):
|
||||
return sorted([c for c in self._unit.classes
|
||||
if c.type == Eolian_Class_Type.MIXIN and
|
||||
c.namespace == self._name])
|
||||
if c.type == Eolian_Class_Type.MIXIN
|
||||
and c.namespace == self._name])
|
||||
|
||||
@property
|
||||
def interfaces(self):
|
||||
return sorted([c for c in self._unit.classes
|
||||
if c.type == Eolian_Class_Type.INTERFACE and
|
||||
c.namespace == self._name])
|
||||
if c.type == Eolian_Class_Type.INTERFACE
|
||||
and c.namespace == self._name])
|
||||
|
||||
@property
|
||||
def aliases(self):
|
||||
|
@ -560,7 +572,7 @@ class Namespace(object):
|
|||
if td.namespace == self._name])
|
||||
|
||||
|
||||
### Eolian Classes ##########################################################
|
||||
# Eolian Classes ############################################################
|
||||
|
||||
class Object(EolianBaseObject):
|
||||
def __new__(cls, c_obj_pointer):
|
||||
|
@ -680,27 +692,27 @@ class Class(Object):
|
|||
|
||||
@cached_property
|
||||
def inherits_full(self):
|
||||
L = []
|
||||
li = []
|
||||
|
||||
def do_class_recursive(cls):
|
||||
if cls.parent:
|
||||
L.append(cls.parent)
|
||||
li.append(cls.parent)
|
||||
for other in cls.extensions:
|
||||
if other not in L:
|
||||
L.append(other)
|
||||
if other not in li:
|
||||
li.append(other)
|
||||
do_class_recursive(other)
|
||||
|
||||
do_class_recursive(self)
|
||||
return L
|
||||
return li
|
||||
|
||||
@cached_property
|
||||
def hierarchy(self):
|
||||
L = []
|
||||
li = []
|
||||
base = self.parent
|
||||
while base:
|
||||
L.append(base)
|
||||
li.append(base)
|
||||
base = base.parent
|
||||
return L
|
||||
return li
|
||||
|
||||
@cached_property
|
||||
def ctor_enable(self):
|
||||
|
@ -710,10 +722,10 @@ class Class(Object):
|
|||
def dtor_enable(self):
|
||||
return bool(lib.eolian_class_dtor_enable_get(self))
|
||||
|
||||
def function_by_name_get(self, func_name,
|
||||
def function_by_name_get(self, function_name,
|
||||
ftype=Eolian_Function_Type.UNRESOLVED):
|
||||
f = lib.eolian_class_function_by_name_get(self,
|
||||
_str_to_bytes(func_name),
|
||||
_str_to_bytes(function_name),
|
||||
ftype)
|
||||
return Function(f) if f else None
|
||||
|
||||
|
@ -868,7 +880,9 @@ class Function(Object):
|
|||
return Iterator(Function_Parameter,
|
||||
lib.eolian_function_parameters_get(self))
|
||||
|
||||
def values_get(self, ftype): # TODO rename in property_values_get (or implement a proper Property class?)
|
||||
def values_get(self, ftype):
|
||||
# TODO rename in property_values_get
|
||||
# (or implement a proper Property class?)
|
||||
return Iterator(Function_Parameter,
|
||||
lib.eolian_property_values_get(self, ftype))
|
||||
|
||||
|
@ -880,7 +894,9 @@ class Function(Object):
|
|||
def setter_values(self): # TODO rename ...
|
||||
return self.values_get(Eolian_Function_Type.PROP_SET)
|
||||
|
||||
def keys_get(self, ftype): # TODO rename in property_keys_get (or implement a proper Property class?)
|
||||
def keys_get(self, ftype):
|
||||
# TODO rename in property_keys_get
|
||||
# (or implement a proper Property class?)
|
||||
return Iterator(Function_Parameter,
|
||||
lib.eolian_property_keys_get(self, ftype))
|
||||
|
||||
|
@ -896,8 +912,8 @@ class Function(Object):
|
|||
c_type = lib.eolian_function_return_type_get(self, ftype)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
def return_default_value(self, ftye):
|
||||
c_expr = lib.eolian_function_return_default_value_get(sel._obj, ftype)
|
||||
def return_default_value(self, ftype):
|
||||
c_expr = lib.eolian_function_return_default_value_get(self._obj, ftype)
|
||||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
def return_documentation(self, ftype):
|
||||
|
@ -1326,11 +1342,12 @@ class Documentation_Token(object):
|
|||
return self._ref
|
||||
|
||||
|
||||
### internal string encode/decode ###########################################
|
||||
# internal string encode/decode #############################################
|
||||
|
||||
def _str_to_bytes(s):
|
||||
return s.encode('utf-8')
|
||||
|
||||
|
||||
def _str_to_py(s):
|
||||
if s is None:
|
||||
return None
|
||||
|
@ -1345,7 +1362,7 @@ def _str_to_py(s):
|
|||
print('WARNING !!!!!!!!! Unknown type: %s' % type(s))
|
||||
|
||||
|
||||
### internal Object type -> Class mapping ###################################
|
||||
# internal Object type -> Class mapping #####################################
|
||||
|
||||
class _Eolian_Object_Type(IntEnum):
|
||||
UNKNOWN = 0
|
||||
|
@ -1364,6 +1381,7 @@ class _Eolian_Object_Type(IntEnum):
|
|||
CONSTRUCTOR = 13
|
||||
DOCUMENTATION = 14
|
||||
|
||||
|
||||
_eolian_type_class_mapping = {
|
||||
_Eolian_Object_Type.UNKNOWN: Object,
|
||||
_Eolian_Object_Type.CLASS: Class,
|
||||
|
@ -1382,17 +1400,20 @@ _eolian_type_class_mapping = {
|
|||
_Eolian_Object_Type.DOCUMENTATION: Documentation,
|
||||
}
|
||||
|
||||
### module init/shutdown ####################################################
|
||||
|
||||
# module init/shutdown ######################################################
|
||||
|
||||
def _cleanup():
|
||||
global _already_halted
|
||||
lib.eolian_shutdown()
|
||||
_already_halted = True
|
||||
|
||||
|
||||
lib.eolian_init()
|
||||
atexit.register(_cleanup)
|
||||
|
||||
|
||||
### API coverage statistics #################################################
|
||||
# API coverage statistics ###################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
|
|
@ -29,7 +29,7 @@ for lib_dir in search_in:
|
|||
file_path = f
|
||||
|
||||
if not file_path:
|
||||
raise RuntimeError('Error: cannot find a built eolian library in source tree')
|
||||
raise RuntimeError('Error: cannot find a built eolian lib in source tree')
|
||||
|
||||
lib = CDLL(file_path)
|
||||
|
||||
|
@ -42,7 +42,8 @@ lib.eolian_init.restype = c_int
|
|||
lib.eolian_shutdown.argtypes = None
|
||||
lib.eolian_shutdown.restype = c_int
|
||||
|
||||
### Eolian_State ############################################################
|
||||
|
||||
# Eolian_State ##############################################################
|
||||
|
||||
# EAPI Eolian_State *eolian_state_new(void);
|
||||
lib.eolian_state_new.argtypes = None
|
||||
|
@ -124,7 +125,8 @@ lib.eolian_state_structs_by_file_get.restype = c_void_p
|
|||
lib.eolian_state_enums_by_file_get.argtypes = (c_void_p, c_char_p)
|
||||
lib.eolian_state_enums_by_file_get.restype = c_void_p
|
||||
|
||||
### Eolian_Unit #############################################################
|
||||
|
||||
# Eolian_Unit ###############################################################
|
||||
|
||||
# EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
|
||||
lib.eolian_unit_children_get.argtypes = (c_void_p,)
|
||||
|
@ -186,7 +188,8 @@ lib.eolian_unit_constant_by_name_get.restype = c_void_p
|
|||
lib.eolian_unit_constants_get.argtypes = (c_void_p,)
|
||||
lib.eolian_unit_constants_get.restype = c_void_p
|
||||
|
||||
### Eolian_Object ###########################################################
|
||||
|
||||
# Eolian_Object #############################################################
|
||||
|
||||
# EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj);
|
||||
lib.eolian_object_type_get.argtypes = (c_void_p,)
|
||||
|
@ -224,7 +227,8 @@ lib.eolian_object_namespaces_get.restype = c_void_p
|
|||
lib.eolian_object_is_beta.argtypes = (c_void_p,)
|
||||
lib.eolian_object_is_beta.restype = c_bool
|
||||
|
||||
### Eolian_Class ############################################################
|
||||
|
||||
# Eolian_Class ##############################################################
|
||||
|
||||
# EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
|
||||
lib.eolian_class_type_get.argtypes = (c_void_p,)
|
||||
|
@ -302,7 +306,8 @@ lib.eolian_class_c_macro_get.restype = c_void_p # Stringshare TO BE FREED
|
|||
lib.eolian_class_c_data_type_get.argtypes = (c_void_p,)
|
||||
lib.eolian_class_c_data_type_get.restype = c_void_p # Stringshare TO BE FREED
|
||||
|
||||
### Eolian_Function #########################################################
|
||||
|
||||
# Eolian_Function ###########################################################
|
||||
|
||||
# EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
|
||||
lib.eolian_function_type_get.argtypes = (c_void_p,)
|
||||
|
@ -369,7 +374,8 @@ lib.eolian_property_keys_get.restype = c_void_p
|
|||
lib.eolian_property_values_get.argtypes = (c_void_p, c_int)
|
||||
lib.eolian_property_values_get.restype = c_void_p
|
||||
|
||||
### Eolian_Function_Parameter ###############################################
|
||||
|
||||
# Eolian_Function_Parameter #################################################
|
||||
|
||||
# EAPI Eolian_Parameter_Direction eolian_parameter_direction_get(const Eolian_Function_Parameter *param);
|
||||
lib.eolian_parameter_direction_get.argtypes = (c_void_p,)
|
||||
|
@ -391,7 +397,8 @@ lib.eolian_parameter_documentation_get.restype = c_void_p
|
|||
lib.eolian_parameter_is_optional.argtypes = (c_void_p,)
|
||||
lib.eolian_parameter_is_optional.restype = c_bool
|
||||
|
||||
### Eolian_Implement ########################################################
|
||||
|
||||
# Eolian_Implement ##########################################################
|
||||
|
||||
# EAPI const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
|
||||
lib.eolian_implement_class_get.argtypes = (c_void_p,)
|
||||
|
@ -425,7 +432,8 @@ lib.eolian_implement_is_prop_get.restype = c_bool
|
|||
lib.eolian_implement_is_prop_set.argtypes = (c_void_p,)
|
||||
lib.eolian_implement_is_prop_set.restype = c_bool
|
||||
|
||||
### Eolian_Constructor ######################################################
|
||||
|
||||
# Eolian_Constructor ########################################################
|
||||
|
||||
# EAPI const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor);
|
||||
lib.eolian_constructor_class_get.argtypes = (c_void_p,)
|
||||
|
@ -439,7 +447,8 @@ lib.eolian_constructor_function_get.restype = c_void_p
|
|||
lib.eolian_constructor_is_optional.argtypes = (c_void_p,)
|
||||
lib.eolian_constructor_is_optional.restype = c_bool
|
||||
|
||||
### Eolian_Event ############################################################
|
||||
|
||||
# Eolian_Event ##############################################################
|
||||
|
||||
# EAPI Eina_Stringshare *eolian_event_c_macro_get(const Eolian_Event *event);
|
||||
lib.eolian_event_c_macro_get.argtypes = (c_void_p,)
|
||||
|
@ -465,7 +474,8 @@ lib.eolian_event_is_hot.restype = c_bool
|
|||
lib.eolian_event_is_restart.argtypes = (c_void_p,)
|
||||
lib.eolian_event_is_restart.restype = c_bool
|
||||
|
||||
### Eolian_Part #############################################################
|
||||
|
||||
# Eolian_Part ###############################################################
|
||||
|
||||
# EAPI const Eolian_Class *eolian_part_class_get(const Eolian_Part *part);
|
||||
lib.eolian_part_class_get.argtypes = (c_void_p,)
|
||||
|
@ -475,7 +485,8 @@ lib.eolian_part_class_get.restype = c_void_p
|
|||
lib.eolian_part_documentation_get.argtypes = (c_void_p,)
|
||||
lib.eolian_part_documentation_get.restype = c_void_p
|
||||
|
||||
### Eolian_Typedecl #########################################################
|
||||
|
||||
# Eolian_Typedecl ###########################################################
|
||||
|
||||
# EAPI Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
|
||||
lib.eolian_typedecl_type_get.argtypes = (c_void_p,)
|
||||
|
@ -549,7 +560,8 @@ lib.eolian_typedecl_free_func_get.restype = c_char_p
|
|||
lib.eolian_typedecl_function_pointer_get.argtypes = (c_void_p,)
|
||||
lib.eolian_typedecl_function_pointer_get.restype = c_void_p
|
||||
|
||||
### Eolian_Type #############################################################
|
||||
|
||||
# Eolian_Type ###############################################################
|
||||
|
||||
# EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
|
||||
lib.eolian_type_type_get.argtypes = (c_void_p,)
|
||||
|
@ -588,10 +600,11 @@ lib.eolian_type_is_ptr.argtypes = (c_void_p,)
|
|||
lib.eolian_type_is_ptr.restype = c_bool
|
||||
|
||||
# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
|
||||
lib.eolian_type_c_type_get.argtypes = (c_void_p)
|
||||
lib.eolian_type_c_type_get.argtypes = (c_void_p,)
|
||||
lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED
|
||||
|
||||
### Eolian_Expression #######################################################
|
||||
|
||||
# Eolian_Expression #########################################################
|
||||
|
||||
# EAPI Eina_Stringshare *eolian_expression_serialize(const Eolian_Expression *expr);
|
||||
lib.eolian_expression_serialize.argtypes = (c_void_p,)
|
||||
|
@ -621,7 +634,8 @@ lib.eolian_expression_unary_operator_get.restype = c_int
|
|||
lib.eolian_expression_unary_expression_get.argtypes = (c_void_p,)
|
||||
lib.eolian_expression_unary_expression_get.restype = c_void_p
|
||||
|
||||
### Eolian_Constant #########################################################
|
||||
|
||||
# Eolian_Constant ###########################################################
|
||||
|
||||
# EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var);
|
||||
lib.eolian_constant_documentation_get.argtypes = (c_void_p,)
|
||||
|
@ -639,7 +653,8 @@ lib.eolian_constant_value_get.restype = c_void_p
|
|||
lib.eolian_constant_is_extern.argtypes = (c_void_p,)
|
||||
lib.eolian_constant_is_extern.restype = c_bool
|
||||
|
||||
### Eolian_Documentation ####################################################
|
||||
|
||||
# Eolian_Documentation ######################################################
|
||||
|
||||
# EAPI Eina_Stringshare *eolian_documentation_summary_get(const Eolian_Documentation *doc);
|
||||
lib.eolian_documentation_summary_get.argtypes = (c_void_p,)
|
||||
|
@ -677,4 +692,3 @@ lib.eolian_doc_token_text_get.restype = c_void_p # char* TO BE FREED
|
|||
# EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2);
|
||||
# lib.eolian_doc_token_ref_resolve.argtypes = (c_void_p, c_void_p, ???, ???)
|
||||
# lib.eolian_doc_token_ref_resolve.restype = c_int
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ PYTHON_PATH, fe:
|
|||
"""
|
||||
import os
|
||||
import datetime
|
||||
import atexit
|
||||
|
||||
try:
|
||||
from . import eolian
|
||||
|
@ -70,11 +71,13 @@ if not eolian_db.all_eot_files_parse():
|
|||
if not eolian_db.all_eo_files_parse():
|
||||
raise(RuntimeError('Eolian, failed to parse all EO files'))
|
||||
|
||||
|
||||
# cleanup the database on exit
|
||||
import atexit
|
||||
def cleanup_db():
|
||||
global eolian_db
|
||||
del eolian_db
|
||||
|
||||
|
||||
atexit.register(cleanup_db)
|
||||
|
||||
|
||||
|
@ -92,6 +95,7 @@ class Template(pyratemp.Template):
|
|||
filename: Template file to load. (REQUIRED)
|
||||
context: User provided context for the template (dict).
|
||||
"""
|
||||
|
||||
def __init__(self, filename, encoding='utf-8', context=None, escape=None,
|
||||
loader_class=pyratemp.LoaderFile,
|
||||
parser_class=pyratemp.Parser,
|
||||
|
|
|
@ -99,26 +99,26 @@ class TestEolianUnit(unittest.TestCase):
|
|||
|
||||
@unittest.skip('Skipped until unit/state support is fixed')
|
||||
def test_children_listing(self):
|
||||
l = list(eolian_db.children)
|
||||
self.assertGreater(len(l), 500)
|
||||
self.assertIsInstance(l[0], eolian.Eolian_Unit)
|
||||
li = list(eolian_db.children)
|
||||
self.assertGreater(len(li), 500)
|
||||
self.assertIsInstance(li[0], eolian.Eolian_Unit)
|
||||
|
||||
def test_file_listing(self):
|
||||
l = list(eolian_db.eo_file_paths)
|
||||
self.assertGreater(len(l), 400)
|
||||
self.assertTrue(l[0].endswith('.eo'))
|
||||
li = list(eolian_db.eo_file_paths)
|
||||
self.assertGreater(len(li), 400)
|
||||
self.assertTrue(li[0].endswith('.eo'))
|
||||
|
||||
l = list(eolian_db.eo_files)
|
||||
self.assertGreater(len(l), 400)
|
||||
self.assertTrue(l[0].endswith('.eo'))
|
||||
li = list(eolian_db.eo_files)
|
||||
self.assertGreater(len(li), 400)
|
||||
self.assertTrue(li[0].endswith('.eo'))
|
||||
|
||||
l = list(eolian_db.eot_file_paths)
|
||||
self.assertGreater(len(l), 10)
|
||||
self.assertTrue(l[0].endswith('.eot'))
|
||||
li = list(eolian_db.eot_file_paths)
|
||||
self.assertGreater(len(li), 10)
|
||||
self.assertTrue(li[0].endswith('.eot'))
|
||||
|
||||
l = list(eolian_db.eot_files)
|
||||
self.assertGreater(len(l), 10)
|
||||
self.assertTrue(l[0].endswith('.eot'))
|
||||
li = list(eolian_db.eot_files)
|
||||
self.assertGreater(len(li), 10)
|
||||
self.assertTrue(li[0].endswith('.eot'))
|
||||
|
||||
def test_object_listing(self):
|
||||
unit = eolian_db.unit_by_file_get('efl_ui_win.eo')
|
||||
|
@ -137,10 +137,10 @@ class TestEolianUnit(unittest.TestCase):
|
|||
self.assertGreater(count, 5)
|
||||
|
||||
def test_enum_listing(self):
|
||||
l = list(eolian_db.enums_by_file_get('efl_ui_win.eo'))
|
||||
self.assertGreater(len(l), 5)
|
||||
self.assertIsInstance(l[0], eolian.Typedecl)
|
||||
self.assertEqual(l[0].type, eolian.Eolian_Typedecl_Type.ENUM)
|
||||
li = list(eolian_db.enums_by_file_get('efl_ui_win.eo'))
|
||||
self.assertGreater(len(li), 5)
|
||||
self.assertIsInstance(li[0], eolian.Typedecl)
|
||||
self.assertEqual(li[0].type, eolian.Eolian_Typedecl_Type.ENUM)
|
||||
|
||||
all_count = 0
|
||||
for enum in eolian_db.enums:
|
||||
|
@ -150,10 +150,10 @@ class TestEolianUnit(unittest.TestCase):
|
|||
self.assertGreater(all_count, 50)
|
||||
|
||||
def test_struct_listing(self):
|
||||
l = list(eolian_db.structs_by_file_get('eina_types.eot'))
|
||||
self.assertGreater(len(l), 10)
|
||||
self.assertIsInstance(l[0], eolian.Typedecl)
|
||||
self.assertIn(l[0].type, (
|
||||
li = list(eolian_db.structs_by_file_get('eina_types.eot'))
|
||||
self.assertGreater(len(li), 10)
|
||||
self.assertIsInstance(li[0], eolian.Typedecl)
|
||||
self.assertIn(li[0].type, (
|
||||
eolian.Eolian_Typedecl_Type.STRUCT,
|
||||
eolian.Eolian_Typedecl_Type.STRUCT_OPAQUE))
|
||||
|
||||
|
@ -167,9 +167,9 @@ class TestEolianUnit(unittest.TestCase):
|
|||
self.assertGreater(all_count, 50)
|
||||
|
||||
def test_alias_listing(self):
|
||||
l = list(eolian_db.aliases_by_file_get('eina_types.eot'))
|
||||
self.assertGreater(len(l), 2)
|
||||
self.assertIsInstance(l[0], eolian.Typedecl)
|
||||
li = list(eolian_db.aliases_by_file_get('eina_types.eot'))
|
||||
self.assertGreater(len(li), 2)
|
||||
self.assertIsInstance(li[0], eolian.Typedecl)
|
||||
|
||||
all_count = 0
|
||||
for alias in eolian_db.aliases:
|
||||
|
@ -181,13 +181,13 @@ class TestEolianUnit(unittest.TestCase):
|
|||
self.assertGreater(all_count, 10)
|
||||
|
||||
def test_constant_listing(self):
|
||||
l = list(eolian_db.constants)
|
||||
self.assertGreater(len(l), 2)
|
||||
self.assertIsInstance(l[0], eolian.Constant)
|
||||
li = list(eolian_db.constants)
|
||||
self.assertGreater(len(li), 2)
|
||||
self.assertIsInstance(li[0], eolian.Constant)
|
||||
|
||||
l = list(eolian_db.constants_by_file_get('efl_gfx_stack.eo'))
|
||||
self.assertGreater(len(l), 1)
|
||||
self.assertIsInstance(l[0], eolian.Constant)
|
||||
li = list(eolian_db.constants_by_file_get('efl_gfx_stack.eo'))
|
||||
self.assertGreater(len(li), 1)
|
||||
self.assertIsInstance(li[0], eolian.Constant)
|
||||
|
||||
def test_class_listing(self):
|
||||
all_count = 0
|
||||
|
@ -544,7 +544,7 @@ class TestEolianType(unittest.TestCase):
|
|||
cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
|
||||
func = cls.function_by_name_get('timer_delay')
|
||||
param = list(func.parameters)[0]
|
||||
t = param.type # type: double
|
||||
t = param.type # type double
|
||||
self.assertIsInstance(t, eolian.Type)
|
||||
self.assertEqual(t.name, 'double')
|
||||
self.assertEqual(t.short_name, 'double')
|
||||
|
@ -563,7 +563,7 @@ class TestEolianType(unittest.TestCase):
|
|||
cls = eolian_db.class_by_name_get('Efl.Gfx.Entity')
|
||||
func = cls.function_by_name_get('geometry')
|
||||
param = list(func.setter_values)[0]
|
||||
t = param.type # type: Eina.Rect
|
||||
t = param.type # type Eina.Rect
|
||||
self.assertIsInstance(t, eolian.Type)
|
||||
self.assertEqual(t.name, 'Eina.Rect')
|
||||
self.assertEqual(t.short_name, 'Rect')
|
||||
|
@ -582,7 +582,7 @@ class TestEolianType(unittest.TestCase):
|
|||
cls = eolian_db.class_by_name_get('Efl.Content')
|
||||
func = cls.function_by_name_get('content')
|
||||
param = list(func.setter_values)[0]
|
||||
t = param.type # type: Efl.Gfx (class interface)
|
||||
t = param.type # type Efl.Gfx (class interface)
|
||||
self.assertIsInstance(t, eolian.Type)
|
||||
self.assertEqual(t.name, 'Efl.Gfx.Entity')
|
||||
self.assertEqual(t.short_name, 'Entity')
|
||||
|
@ -624,7 +624,6 @@ class TestEolianExpression(unittest.TestCase):
|
|||
# exp.binary_rhs # TODO find a better test (only works for BINARY expr)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# create main eolian state
|
||||
eolian_db = eolian.Eolian_State()
|
||||
|
|
Loading…
Reference in New Issue