python类testmod()的实例源码

doctest.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def report_failure(self, out, test, example, got):
        raise DocTestFailure(test, example, got)

######################################################################
## 6. Test Functions
######################################################################
# These should be backwards compatible.

# For backward compatibility, a global instance of a DocTestRunner
# class, updated by testmod.
doctest.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run_docstring_examples(f, globs, verbose=False, name="NoName",
                           compileflags=None, optionflags=0):
    """
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `compileflags` gives the set of flags that should be used by the
    Python compiler when running the examples.  If not specified, then
    it will default to the set of future-import flags that apply to
    `globs`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    """
    # Find, parse, and run all tests in the given module.
    finder = DocTestFinder(verbose=verbose, recurse=False)
    runner = DocTestRunner(verbose=verbose, optionflags=optionflags)
    for test in finder.find(f, name, globs=globs):
        runner.run(test, compileflags=compileflags)

######################################################################
## 7. Tester
######################################################################
# This is provided only for backwards compatibility.  It's not
# actually used in any way.
recipe-521888.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _test():
    import doctest
    doctest.testmod()
recipe-473818.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def _test():
    import doctest
    doctest.testmod()
recipe-285211.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _test():
    import doctest
    return doctest.testmod()
recipe-535145.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def _test():
    import doctest
    doctest.testmod()
recipe-551778.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _test():
    import doctest, stripxml
    doctest.testmod(stripxml)
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_local():
    failures, _ = doctest.testmod(local, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_ondisk():
    if has_special_dependencies:
        failures, _ = doctest.testmod(ondisk, report=True)
        assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_s3():

    failures, _ = doctest.testmod(s3, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_caching():

    failures, _ = doctest.testmod(caching, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_docs_pythonapi_creating_archives(example_snippet_working_dirs):
    failures, _ = doctest.testmod(pythonapi_creating_archives, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 66 收藏 0 点赞 0 评论 0
def test_docs_pythonapi_tagging(example_snippet_working_dirs):
    failures, _ = doctest.testmod(pythonapi_tagging, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_docs_pythonapi_dependencies(example_snippet_working_dirs):
    failures, _ = doctest.testmod(pythonapi_dependencies, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_docs_pythonapi_io(example_snippet_working_dirs):
    if has_special_dependencies:
        failures, _ = doctest.testmod(pythonapi_io, report=True)
        assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_docs_pythonapi_metadata(example_snippet_working_dirs):
    failures, _ = doctest.testmod(pythonapi_metadata, report=True)
    assert failures == 0
test_examples.py 文件源码 项目:DataFS 作者: ClimateImpactLab 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_docs_pythonapi_finding_archives(example_snippet_working_dirs):
    failures, _ = doctest.testmod(pythonapi_finding_archives, report=True)
    assert failures == 0
__init__.py 文件源码 项目:sndlatr 作者: Schibum 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _test():
    import doctest, os, sys
    sys.path.insert(0, os.pardir)
    import pytz
    return doctest.testmod(pytz)
native_package_install.py 文件源码 项目:elm-ops-tooling 作者: NoRedInk 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test():
    import doctest
    doctest.testmod()
test_doc.py 文件源码 项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def testModule(name):
    print "--- Test module %s" % name
    module = importModule(name)
    failure, nb_test = testmod(module)
    if failure:
        exit(1)
    print "--- End of test"


问题


面经


文章

微信
公众号

扫码关注公众号