Fixed compatiblity issues in stubout
This commit is contained in:
parent
b13fe45f54
commit
7de1beb8c8
|
@ -61,7 +61,7 @@ class StubOutForTesting:
|
|||
Raises AttributeError if the attribute cannot be found.
|
||||
"""
|
||||
if (inspect.ismodule(obj) or
|
||||
(not inspect.isclass(obj) and obj.__dict__.has_key(attr_name))):
|
||||
(not inspect.isclass(obj) and attr_name in obj.__dict__)):
|
||||
orig_obj = obj
|
||||
orig_attr = getattr(obj, attr_name)
|
||||
|
||||
|
@ -124,7 +124,7 @@ class StubOutForTesting:
|
|||
if isinstance(old_attribute, staticmethod):
|
||||
old_child = staticmethod(old_child)
|
||||
elif isinstance(old_attribute, classmethod):
|
||||
old_child = classmethod(old_child.im_func)
|
||||
old_child = classmethod(old_child.__func__)
|
||||
|
||||
self.cache.append((parent, old_child, child_name))
|
||||
setattr(parent, child_name, new_child)
|
||||
|
|
Loading…
Reference in New Issue