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


Python doctest.IGNORE_EXCEPTION_DETAIL属性代码示例

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


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

示例1: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def load_tests(loader, tests, ignore):
    # This function loads doctests from all submodules and runs them
    # with the __future__ imports necessary for Python 2
    for _, module, _ in pkgutil.walk_packages(path=blocks.__path__,
                                              prefix=blocks.__name__ + '.'):
        try:
            tests.addTests(doctest.DocTestSuite(
                module=importlib.import_module(module), setUp=setup,
                optionflags=doctest.IGNORE_EXCEPTION_DETAIL))
        except:
            pass

    # This part loads the doctests from the documentation
    docs = []
    for root, _, filenames in os.walk(os.path.join(blocks.__path__[0],
                                                   '../docs')):
        for doc in fnmatch.filter(filenames, '*.rst'):
            docs.append(os.path.abspath(os.path.join(root, doc)))
    tests.addTests(doctest.DocFileSuite(
        *docs, module_relative=False, setUp=setup,
        optionflags=doctest.IGNORE_EXCEPTION_DETAIL))

    return tests 
开发者ID:rizar,项目名称:attention-lvcsr,代码行数:25,代码来源:__init__.py

示例2: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def load_tests(loader, tests, ignore):
    # This function loads doctests from all submodules and runs them
    # with the __future__ imports necessary for Python 2
    for _, module, _ in pkgutil.walk_packages(path=fuel.__path__,
                                              prefix=fuel.__name__ + '.'):
        try:
            tests.addTests(doctest.DocTestSuite(
                module=importlib.import_module(module), setUp=setup,
                optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
                checker=Py23DocChecker()))
        except:
            pass

    # This part loads the doctests from the documentation
    docs = []
    for root, _, filenames in os.walk(os.path.join(fuel.__path__[0],
                                                   '../docs')):
        for doc in fnmatch.filter(filenames, '*.rst'):
            docs.append(os.path.abspath(os.path.join(root, doc)))
    tests.addTests(doctest.DocFileSuite(
        *docs, module_relative=False, setUp=setup,
        optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
        checker=Py23DocChecker()))

    return tests 
开发者ID:rizar,项目名称:attention-lvcsr,代码行数:27,代码来源:__init__.py

示例3: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def load_tests(loader, tests, ignore):
    module_doctests = [
        urwid.widget,
        urwid.wimp,
        urwid.decoration,
        urwid.display_common,
        urwid.main_loop,
        urwid.monitored_list,
        urwid.raw_display,
        'urwid.split_repr', # override function with same name
        urwid.util,
        urwid.signals,
        ]
    for m in module_doctests:
        tests.addTests(doctest.DocTestSuite(m,
            optionflags=doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL))
    return tests 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:19,代码来源:test_doctests.py

示例4: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def load_tests(loader, tests, ignore):
    # This function loads doctests from all submodules and runs them
    # with the __future__ imports necessary for Python 2
    for _, module, _ in pkgutil.walk_packages(path=fuel.__path__,
                                              prefix=fuel.__name__ + '.'):
        try:
            tests.addTests(doctest.DocTestSuite(
                module=importlib.import_module(module), setUp=setup,
                optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
                checker=Py23DocChecker()))
        except Exception:
            pass

    # This part loads the doctests from the documentation
    docs = []
    for root, _, filenames in os.walk(os.path.join(fuel.__path__[0],
                                                   '../docs')):
        for doc in fnmatch.filter(filenames, '*.rst'):
            docs.append(os.path.abspath(os.path.join(root, doc)))
    tests.addTests(doctest.DocFileSuite(
        *docs, module_relative=False, setUp=setup,
        optionflags=doctest.IGNORE_EXCEPTION_DETAIL,
        checker=Py23DocChecker()))

    return tests 
开发者ID:mila-iqia,项目名称:fuel,代码行数:27,代码来源:__init__.py

示例5: _run_doctest_for_content

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def _run_doctest_for_content(self, name, content):
        optionflags = (
            doctest.ELLIPSIS
            | doctest.NORMALIZE_WHITESPACE
            | doctest.IGNORE_EXCEPTION_DETAIL
            | _get_allow_unicode_flag()
        )
        runner = doctest.DocTestRunner(
            verbose=None,
            optionflags=optionflags,
            checker=_get_unicode_checker(),
        )
        globs = {"print_function": print_function}
        parser = doctest.DocTestParser()
        test = parser.get_doctest(content, globs, name, name, 0)
        runner.run(test)
        runner.summarize()
        assert not runner.failures 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:20,代码来源:test_tutorials.py

示例6: _get_flag_lookup

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def _get_flag_lookup():
    import doctest

    return dict(
        DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
        DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
        NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
        ELLIPSIS=doctest.ELLIPSIS,
        IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL,
        COMPARISON_FLAGS=doctest.COMPARISON_FLAGS,
        ALLOW_UNICODE=_get_allow_unicode_flag(),
        ALLOW_BYTES=_get_allow_bytes_flag(),
    ) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:15,代码来源:doctest.py

示例7: testsuite

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def testsuite():
    import doctest
    return doctest.DocTestSuite(optionflags=doctest.IGNORE_EXCEPTION_DETAIL) 
开发者ID:cyber-prog0x,项目名称:PoC-Bank,代码行数:5,代码来源:acefile.py

示例8: test

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def test():
    import doctest
    fails, tests = doctest.testmod(optionflags=doctest.IGNORE_EXCEPTION_DETAIL)
    sys.exit(min(1, fails)) 
开发者ID:cyber-prog0x,项目名称:PoC-Bank,代码行数:6,代码来源:acefile.py

示例9: _get_flag_lookup

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def _get_flag_lookup() -> Dict[str, int]:
    import doctest

    return dict(
        DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
        DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
        NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
        ELLIPSIS=doctest.ELLIPSIS,
        IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL,
        COMPARISON_FLAGS=doctest.COMPARISON_FLAGS,
        ALLOW_UNICODE=_get_allow_unicode_flag(),
        ALLOW_BYTES=_get_allow_bytes_flag(),
        NUMBER=_get_number_flag(),
    ) 
开发者ID:pytest-dev,项目名称:pytest,代码行数:16,代码来源:doctest.py

示例10: test

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def test(args):
    """Run tests (--test)."""
    return test_suite(args, unittest.TestSuite((
        TestLoader().load_tests_from_subclass(UnitTestCase),
        doctest.DocTestSuite(optionflags=(
            doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL)),
    ))) 
开发者ID:kuba,项目名称:simp_le,代码行数:9,代码来源:simp_le.py

示例11: load_tests

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def load_tests(loader, tests, ignore):
    flags = (doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL)
    tests.addTests(doctest.DocTestSuite(fake_providers, optionflags=flags))
    return tests 
开发者ID:mfussenegger,项目名称:cr8,代码行数:6,代码来源:test_fake_providers.py

示例12: test_main

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import IGNORE_EXCEPTION_DETAIL [as 别名]
def test_main(arith=None, verbose=None, todo_tests=None, debug=None):
    """ Execute the tests.

    Runs all arithmetic tests if arith is True or if the "decimal" resource
    is enabled in regrtest.py
    """

    init(C)
    init(P)
    global TEST_ALL, DEBUG
    TEST_ALL = arith if arith is not None else is_resource_enabled('decimal')
    DEBUG = debug

    if todo_tests is None:
        test_classes = all_tests
    else:
        test_classes = [CIBMTestCases, PyIBMTestCases]

    # Dynamically build custom test definition for each file in the test
    # directory and add the definitions to the DecimalTest class.  This
    # procedure insures that new files do not get skipped.
    for filename in os.listdir(directory):
        if '.decTest' not in filename or filename.startswith("."):
            continue
        head, tail = filename.split('.')
        if todo_tests is not None and head not in todo_tests:
            continue
        tester = lambda self, f=filename: self.eval_file(directory + f)
        setattr(CIBMTestCases, 'test_' + head, tester)
        setattr(PyIBMTestCases, 'test_' + head, tester)
        del filename, head, tail, tester


    try:
        run_unittest(*test_classes)
        if todo_tests is None:
            from doctest import IGNORE_EXCEPTION_DETAIL
            savedecimal = sys.modules['decimal']
            if C:
                sys.modules['decimal'] = C
                run_doctest(C, verbose, optionflags=IGNORE_EXCEPTION_DETAIL)
            sys.modules['decimal'] = P
            run_doctest(P, verbose)
            sys.modules['decimal'] = savedecimal
    finally:
        if C: C.setcontext(ORIGINAL_CONTEXT[C])
        P.setcontext(ORIGINAL_CONTEXT[P])
        if not C:
            warnings.warn('C tests skipped: no module named _decimal.',
                          UserWarning)
        if not orig_sys_decimal is sys.modules['decimal']:
            raise TestFailed("Internal error: unbalanced number of changes to "
                             "sys.modules['decimal'].") 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:55,代码来源:test_decimal.py


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