我有一门课,它做类似的事情:
class MyClass(object):
def __init__(self, delegate_to):
self._delegate_to = delegate_to
def __getattr__(self, item):
return getattr(self._delegate_to, item)
但是当我尝试做类似的事情时:
my_mock = self.mox.CreateMock(MyClass)
my_mock.f().AndReturn(None)
mox 错误:
UnknownMethodCallError: Method called is not a member of the object: f
如何模拟委托调用?