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 检查是否调用了方法而不模拟它