本文整理匯總了Python中numpy.testing.decorators.setastest方法的典型用法代碼示例。如果您正苦於以下問題:Python decorators.setastest方法的具體用法?Python decorators.setastest怎麽用?Python decorators.setastest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.testing.decorators
的用法示例。
在下文中一共展示了decorators.setastest方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setastest
# 需要導入模塊: from numpy.testing import decorators [as 別名]
# 或者: from numpy.testing.decorators import setastest [as 別名]
def setastest(tf=True):
"""
Signals to nose that this function is or is not a test.
Parameters
----------
tf : bool
If True, specifies that the decorated callable is a test.
If False, specifies that the decorated callable is not a test.
Default is True.
Notes
-----
This decorator can't use the nose namespace, because it can be
called from a non-test module. See also ``istest`` and ``nottest`` in
``nose.tools``.
Examples
--------
`setastest` can be used in the following way::
from numpy.testing.decorators import setastest
@setastest(False)
def func_with_test_in_name(arg1, arg2):
pass
"""
def set_test(t):
t.__test__ = tf
return t
return set_test