class A():
def tmp(self):
print("hi")
def b(a):
a.tmp # note that a.tmp() is not being called. In the project I am working on, a.tmp is being passed as a lambda to a spark executor. And as a.tmp is being invoked in an executor(which is a different process), I can't assert the call of tmp
我想测试是否调用过a.tmp。我该怎么做?请注意,我仍然不想模仿tmp()方法,而是更喜欢python check if a method is called without mocking it away行中的内容
没有经过测试,也许有更好的方法来使用
Mock
,但无论如何:相关问题 更多 >
编程相关推荐