似乎有一个包来启用此功能,但我在python 3.5.2或2.7.12中没有运气:
from ipython_doctester import test
@test
def my_fun():
'''
>>> 2 + 3
6
'''
pass
TypeError: data must be a dict, got: 'ipython_doctester'
Run Code Online (Sandbox Code Playgroud)
是否可以使用此软件包或其他方式从jupyter单元格运行doctest?
我也看了%doctest_mode,我发现它关闭了Doctest模式,但是无法从单元格运行实际的doctest.