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


Python doctest.Tester方法代码示例

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


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

示例1: __init__

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import Tester [as 别名]
def __init__(self, mod=None, globs=None, verbose=None,
                 isprivate=None, optionflags=0):

        warnings.warn("class Tester is deprecated; "
                      "use class doctest.DocTestRunner instead",
                      DeprecationWarning, stacklevel=2)
        if mod is None and globs is None:
            raise TypeError("Tester.__init__: must specify mod or globs")
        if mod is not None and not inspect.ismodule(mod):
            raise TypeError("Tester.__init__: mod must be a module; %r" %
                            (mod,))
        if globs is None:
            globs = mod.__dict__
        self.globs = globs

        self.verbose = verbose
        self.isprivate = isprivate
        self.optionflags = optionflags
        self.testfinder = DocTestFinder(_namefilter=isprivate)
        self.testrunner = DocTestRunner(verbose=verbose,
                                        optionflags=optionflags) 
开发者ID:linuxscout,项目名称:mishkal,代码行数:23,代码来源:doctest24.py

示例2: __init__

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import Tester [as 别名]
def __init__(self, mod=None, globs=None, verbose=None, optionflags=0):

        warnings.warn("class Tester is deprecated; "
                      "use class doctest.DocTestRunner instead",
                      DeprecationWarning, stacklevel=2)
        if mod is None and globs is None:
            raise TypeError("Tester.__init__: must specify mod or globs")
        if mod is not None and not inspect.ismodule(mod):
            raise TypeError("Tester.__init__: mod must be a module; %r" %
                            (mod,))
        if globs is None:
            globs = mod.__dict__
        self.globs = globs

        self.verbose = verbose
        self.optionflags = optionflags
        self.testfinder = DocTestFinder()
        self.testrunner = DocTestRunner(verbose=verbose,
                                        optionflags=optionflags) 
开发者ID:glmcdona,项目名称:meddle,代码行数:21,代码来源:doctest.py

示例3: old_test2

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import Tester [as 别名]
def old_test2(): r"""
        >>> from doctest import Tester
        >>> t = Tester(globs={}, verbose=1)
        >>> test = r'''
        ...    # just an example
        ...    >>> x = 1 + 2
        ...    >>> x
        ...    3
        ... '''
        >>> t.runstring(test, "Example")
        Running string Example
        Trying:
            x = 1 + 2
        Expecting nothing
        ok
        Trying:
            x
        Expecting:
            3
        ok
        0 of 2 examples failed in string Example
        TestResults(failed=0, attempted=2)
""" 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:test_doctest.py

示例4: test_main

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import Tester [as 别名]
def test_main():
    # Check the doctest cases in doctest itself:
    test_support.run_doctest(doctest, verbosity=True)

    from test import test_doctest

    # Ignore all warnings about the use of class Tester in this module.
    deprecations = []
    if __debug__:
        deprecations.append(("class Tester is deprecated", DeprecationWarning))
    if sys.py3kwarning:
        deprecations += [("backquote not supported", SyntaxWarning),
                         ("execfile.. not supported", DeprecationWarning)]
    with test_support.check_warnings(*deprecations):
        # Check the doctest cases defined here:
        test_support.run_doctest(test_doctest, verbosity=True) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:test_doctest.py

示例5: old_test2

# 需要导入模块: import doctest [as 别名]
# 或者: from doctest import Tester [as 别名]
def old_test2(): r"""
        >>> from doctest import Tester
        >>> t = Tester(globs={}, verbose=1)
        >>> test = r'''
        ...    # just an example
        ...    >>> x = 1 + 2
        ...    >>> x
        ...    3
        ... '''
        >>> t.runstring(test, "Example")
        Running string Example
        Trying:
            x = 1 + 2
        Expecting nothing
        ok
        Trying:
            x
        Expecting:
            3
        ok
        0 of 2 examples failed in string Example
        (0, 2)
""" 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:25,代码来源:test_doctest.py


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