in doubles/target.py [0:0]
def get_callable_attr(self, attr_name):
"""Used to double methods added to an object after creation
:param str attr_name: the name of the original attribute to return
:return: Attribute or None.
:rtype: func
"""
if not hasattr(self.doubled_obj, attr_name):
return None
func = getattr(self.doubled_obj, attr_name)
if not is_callable(func):
return None
attr = Attribute(
func,
'attribute',
self.doubled_obj if self.is_class_or_module() else self.doubled_obj_type,
)
self.attrs[attr_name] = attr
return attr