numpy.testing.rundocs#

testing.rundocs(filename=None, raise_on_error=True)[source]#

執行在給定檔案中找到的 doctest。

預設情況下,rundocs 在失敗時會引發 AssertionError。

參數:
filenamestr

要執行 doctest 的檔案路徑。

raise_on_errorbool

當 doctest 失敗時是否引發 AssertionError。預設值為 True。

註解

使用者/開發人員可以透過將 doctests 參數添加到 test() 呼叫來執行 doctest。例如,要對 numpy.lib 執行所有測試(包括 doctest)

>>> np.lib.test(doctests=True)