当前位置: 首页>>代码示例>>Python>>正文


Python doctest.REPORT_ONLY_FIRST_FAILURE属性代码示例

本文整理汇总了Python中doctest.REPORT_ONLY_FIRST_FAILURE属性的典型用法代码示例。如果您正苦于以下问题:Python doctest.REPORT_ONLY_FIRST_FAILURE属性的具体用法?Python doctest.REPORT_ONLY_FIRST_FAILURE怎么用?Python doctest.REPORT_ONLY_FIRST_FAILURE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在doctest的用法示例。


在下文中一共展示了doctest.REPORT_ONLY_FIRST_FAILURE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_report_choice

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def _get_report_choice(key):
    """
    This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
    importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
    """
    import doctest

    return {
        DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
        DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
        DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
        DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
        DOCTEST_REPORT_CHOICE_NONE: 0,
    }[key] 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:16,代码来源:doctest.py

示例2: doctests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def doctests():
    import doctest
    import hts.htsffi
    for name, mod in (("htsffi", hts.htsffi),
                      ("fai", hts.fai),
                      ("fisher", hts.fisher),
                      ("vcf", hts.vcf),
                      ("bam", hts.bam)):

        mod = getattr(hts, name)
        print("%s: %r" % (name, doctest.testmod(m=mod,
                          optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))) 
开发者ID:brentp,项目名称:hts-python,代码行数:14,代码来源:__init__.py

示例3: _get_report_choice

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def _get_report_choice(key: str) -> int:
    """
    This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
    importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
    """
    import doctest

    return {
        DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
        DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
        DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
        DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
        DOCTEST_REPORT_CHOICE_NONE: 0,
    }[key] 
开发者ID:pytest-dev,项目名称:pytest,代码行数:16,代码来源:doctest.py

示例4: test

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def test(cls, verbose=False):

    res = doctest.testfile(
            TEST_FILE,
            globs={'Sentence': cls},
            verbose=verbose,
            optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)
    tag = 'FAIL' if res.failed else 'OK'
    print(TEST_MSG.format(cls.__module__, res, tag)) 
开发者ID:fluentpython,项目名称:notebooks,代码行数:11,代码来源:sentence_runner.py

示例5: test

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def test(gen_factory, verbose=False):
    res = doctest.testfile(
            TEST_FILE,
            globs={'aritprog_gen': gen_factory},
            verbose=verbose,
            optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)
    tag = 'FAIL' if res.failed else 'OK'
    print(TEST_MSG.format(gen_factory.__module__, res, tag)) 
开发者ID:fluentpython,项目名称:notebooks,代码行数:10,代码来源:aritprog_runner.py

示例6: test

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def test(cls, verbose=False):

    res = doctest.testfile(
            TEST_FILE,
            globs={'ConcreteTombola': cls},  # <5>
            verbose=verbose,
            optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)
    tag = 'FAIL' if res.failed else 'OK'
    print(TEST_MSG.format(cls.__name__, res, tag))  # <6> 
开发者ID:fluentpython,项目名称:notebooks,代码行数:11,代码来源:tombola_runner.py

示例7: _report_first_flag

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import REPORT_ONLY_FIRST_FAILURE [as 别名]
def _report_first_flag():
    if os.getenv("REPORT_ONLY_FIRST_FAILURE") == "1":
        return doctest.REPORT_ONLY_FIRST_FAILURE
    return 0 
开发者ID:guildai,项目名称:guildai,代码行数:6,代码来源:_test.py


注:本文中的doctest.REPORT_ONLY_FIRST_FAILURE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。