doctests.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:robocup-soccer 作者: kengz 项目源码 文件源码
def run_tests(modules, verbose=None):
    "Run tests for a list of modules; then summarize results."
    for module in modules:
        tests, demos = split_extra_tests(module.__name__ + ".txt")
        if tests:
            if '__doc__' not in dir(module):
                module.__doc__ = ''
            module.__doc__ += '\n' + tests + '\n'
        doctest.testmod(module, report=0, verbose=verbose)
        if demos:
            for stmt in re.findall(">>> (.*)", demos):
                exec stmt in module.__dict__
    doctest.master.summarize()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号