numpy.testing.rundocs#

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

运行给定文件中的 doctest。

默认情况下,rundocs 在失败时会引发 AssertionError。

参数:
filenamestr

要运行 doctest 的文件路径。

raise_on_errorbool

当 doctest 失败时是否引发 AssertionError。默认为 True。

备注

用户/开发者可以通过将 doctests 参数添加到 test() 调用来运行 doctest。例如,要运行 numpy.lib 的所有测试(包括 doctest)

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