首页 > 解决方案 > Django:测试时如何忽略函数中的部分代码

问题描述

我不在乎做什么some_other_functipn_2和做什么some_other_function。我只需要断言这test_target就是所谓的。这是我的代码的简化版本。我知道这可以通过修补来完成,但我的代码有太多需要修补的部分。无论如何,除了目标之外,是否可以忽略其他所有内容?

def abc():
 a = some_other_function()
 b = some_other_functipn_2(a)
 test_target(b)

标签: djangounit-testing

解决方案


推荐阅读