python - Pytest 断言具有异常块但未引发异常的函数
问题描述
在 pytest 中,我需要对像 a() 这样的函数进行单元测试
def a():
try:
some_error_line
except Exception,e:
logging.debug("----")
如何断言不引发异常的函数 a() ?
解决方案
推荐阅读
- javascript - 如何在滚动时关闭移动导航栏
- c++ - 为什么与第一次相比,再次运行时此选择排序代码显示不同的输出
- flutter - 为什么 dart "is" 运算符对局部变量和类字段的行为不同?
- excel - 异常 Visual Basic .NET 剪贴板文本到 Excel 通过 Interop/Worksheet.Paste()
- apache-flink - Flink 中的树评估
- c# - 如何从 FileStream 读取数据并在中间将它们添加到队列中
- amazon-web-services - 如何强制网络抓取脚本根据我的国家而不是 AWS 的服务器位置获取结果?
- git - 本地分支的 Git 提交到 repo 也会复制主文件
- vue.js - 需要在 AG-Grid 过滤器中使用空格分隔值来返回每个匹配项
- amazon-web-services - 使用 AWS_CLI 执行 aws iam list-users 时出错