【发布时间】:2017-06-04 13:46:49
【问题描述】:
假设我有这样的功能:
def foo():
bar()
当我没有将 bar 作为参数传递时,有什么方法可以测试是否调用了 bar?我的团队使用 Python 3.6 和 3.5
【问题讨论】:
-
您可以修改these function call counting decorators 以满足您的目的。
-
有多种选择,具体取决于您的具体需求 - 搜索
python decorator function logging。试一试,如果遇到问题,请回来提出相关问题。
标签: python unit-testing testing python-mock