當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。