numpy.testing.dec.setastest

testing.dec.setastest(tf=True)[源代码]

向鼻子发出信号,表明此功能是或不是测试。

参数
tf布尔

如果为true,则指定修饰的可调用项是一个测试。如果为false,则指定修饰的可调用文件不是测试。默认值为true。

笔记

这个修饰器不能使用nose名称空间,因为它可以从非测试模块调用。也见 istestnottest 在里面 nose.tools .

实例

setastest 可按以下方式使用:

from numpy.testing import dec

@dec.setastest(False)
def func_with_test_in_name(arg1, arg2):
    pass