numpy.testing.suppress_warnings.record#
方法
- testing.suppress_warnings.record(category=<class 'Warning'>, message='', module=None)[源代码]#
添加新的记录过滤器,或在进入状态时应用。
所有匹配的警告都将被追加到
log属性中。- 参数:
- categoryclass, optional
要过滤的警告类
- messagestring, optional
匹配警告消息的正则表达式。
- modulemodule, optional
要过滤的模块。请注意,模块(及其文件)必须精确匹配,不能是子模块。这可能会使其对外部模块不可靠。
- 返回:
- loglist
一个将被填入所有匹配警告的列表。
备注
在上下文内添加时,过滤器仅在上下文内添加,并在退出上下文时被忘记。