當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python numpy dec.slow用法及代碼示例

本文簡要介紹 python 語言中 numpy.testing.dec.slow 的用法。

用法:

testing.dec.slow(t)

將測試標記為‘slow’。

慢速測試的確切定義顯然是主觀的和hardware-dependent,但通常任何需要超過一兩秒的單獨測試都應標記為慢速(整個套件由數千個測試組成,所以即使一秒鍾也是重大)。

參數

t 可調用的

標記為慢的測試。

返回

t 可調用的

裝飾測試 t。

例子

numpy.testing 模塊包括 import decorators as dec 。測試可以像這樣緩慢地裝飾:

from numpy.testing import *

@dec.slow
def test_big(self):
    print('Big, slow test')

相關用法


注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.testing.dec.slow。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。