django - 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)
解决方案
推荐阅读
- html - 如何使图像在悬停时向右扩展(而不是向左)?
- python-3.x - 带有可变参数的函数参数,避免使用“if arg is None”构造
- varnish - Varnish 配置不正确,导致您提到的网站加载到“defaultwebpage.cgi
- r - 计算数据框中不为零的列数
- r - 在 R 中解释决策树回归输出
- windbg - WinDbg 使用 SOS 显示 CLR (c#) 异常
- c - C 编程语言中的 %ms
- django - Django模板dictsort在西班牙语时没有正确排序
- c# - 将文件从文件夹复制到另一个具有特定文件名的文件夹从文本框中
- bash - 比较 xclip 给出的两个文件