一种将任何python模块转换为doctest就绪的doc字符串的方法。
mod2doctest的Python项目详细描述
mod2doctest是一个将python模块转换为doctest的模块 兼容的docstring。
这有点像使用python脚本,将其粘贴到交互式 解释器,然后将输出复制回docstring。
但是,mod2doctest有许多方便之处,可以使此过程更容易,例如:
- Providing #> and #| comments: #> prints to both your docstring and stdout and #| print just to your docstring (which will show up as text in a sphinx generated webpage)
- adding ellipse markers for memory id / trace back
- Cleaning up / formatting your docstring for sphinx inclusion
- and a couple of other things, too.
有关完整的文档和几个示例,请访问 http://packages.python.org/mod2doctest/。