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


Python test_support.run_doctest函数代码示例

本文整理汇总了Python中test.test_support.run_doctest函数的典型用法代码示例。如果您正苦于以下问题:Python run_doctest函数的具体用法?Python run_doctest怎么用?Python run_doctest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_main

def test_main(verbose=None):
    from test import test_urllib2

    test_support.run_doctest(test_urllib2, verbose)
    test_support.run_doctest(urllib2, verbose)
    tests = (TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests, RequestTests)
    test_support.run_unittest(*tests)
开发者ID:int3,项目名称:jython,代码行数:7,代码来源:test_urllib2.py

示例2: test_libref_examples

    def test_libref_examples(self):
        s = """
        Examples from the Library Reference:  Doc/lib/libgetopt.tex

        An example using only Unix style options:


        >>> import getopt
        >>> args = '-a -b -cfoo -d bar a1 a2'.split()
        >>> args
        ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']
        >>> optlist, args = getopt.getopt(args, 'abc:d:')
        >>> optlist
        [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]
        >>> args
        ['a1', 'a2']

        Using long option names is equally easy:


        >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
        >>> args = s.split()
        >>> args
        ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']
        >>> optlist, args = getopt.getopt(args, 'x', [
        ...     'condition=', 'output-file=', 'testing'])
        >>> optlist
        [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]
        >>> args
        ['a1', 'a2']
        """

        import types
        m = types.ModuleType("libreftest", s)
        run_doctest(m, verbose)
开发者ID:CaoYouXin,项目名称:myfirstapicloudapp,代码行数:35,代码来源:test_getopt.py

示例3: test_main

def test_main(verbose=None):
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs,
                    TestCollectionABCs, TestCounter,
                    TestOrderedDict, GeneralMappingTests, SubclassMappingTests]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
开发者ID:carlosrcjunior,项目名称:BCC-2s13-PI4-WebCrawler,代码行数:7,代码来源:test_collections.py

示例4: test_main

def test_main(arith=False, verbose=None):
    """ Execute the tests.

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

    init()
    global TEST_ALL
    TEST_ALL = arith or is_resource_enabled('decimal')

    test_classes = [
        DecimalExplicitConstructionTest,
        DecimalImplicitConstructionTest,
        DecimalArithmeticOperatorsTest,
        DecimalUseOfContextTest,
        DecimalUsabilityTest,
        DecimalPythonAPItests,
        ContextAPItests,
        DecimalTest,
        WithStatementTest,
    ]

    try:
        run_unittest(*test_classes)
        import decimal as DecimalModule
        run_doctest(DecimalModule, verbose)
    finally:
        setcontext(ORIGINAL_CONTEXT)
开发者ID:Oize,项目名称:pspstacklesspython,代码行数:29,代码来源:test_decimal.py

示例5: test_main

def test_main():
    test_support.run_unittest(
        PickleTests,
        PicklerTests,
        PersPicklerTests
    )
    test_support.run_doctest(pickle)
开发者ID:B-Rich,项目名称:breve,代码行数:7,代码来源:test_pickle.py

示例6: test_main

def test_main(verbose=None):
    from test import test_sets
    test_support.run_unittest(
        TestSetOfSets,
        TestExceptionPropagation,
        TestBasicOpsEmpty,
        TestBasicOpsSingleton,
        TestBasicOpsTuple,
        TestBasicOpsTriple,
        TestBinaryOps,
        TestUpdateOps,
        TestMutate,
        TestSubsetEqualEmpty,
        TestSubsetEqualNonEmpty,
        TestSubsetEmptyNonEmpty,
        TestSubsetPartial,
        TestSubsetNonOverlap,
        TestOnlySetsNumeric,
        TestOnlySetsDict,
        TestOnlySetsOperator,
        TestOnlySetsTuple,
        TestOnlySetsString,
        TestOnlySetsGenerator,
        TestCopyingEmpty,
        TestCopyingSingleton,
        TestCopyingTriple,
        TestCopyingTuple,
        TestCopyingNested,
        TestIdentities,
    )
    test_support.run_doctest(test_sets, verbose)
开发者ID:OS2World,项目名称:APP-INTERNET-torpak_2,代码行数:31,代码来源:test_sets.py

示例7: test_main

def test_main():
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        )
    test_support.run_doctest(sys.modules[__name__])
开发者ID:alkorzt,项目名称:pypy,代码行数:8,代码来源:test_weakref.py

示例8: test_main

def test_main(verbose=None):
    # Obscure:  import this module as test.test_descrtut instead of as
    # plain test_descrtut because the name of this module works its way
    # into the doctest examples, and unless the full test.test_descrtut
    # business is used the name can change depending on how the test is
    # invoked.
    from test import test_support, test_descrtut
    test_support.run_doctest(test_descrtut, verbose)
开发者ID:321boom,项目名称:The-Powder-Toy,代码行数:8,代码来源:test_descrtut.py

示例9: test_main

def test_main(verbose=None):
    if sys.flags.optimize >= 2:
        print >>sys.stderr, "test_collections -- skipping some tests due to -O flag."
        sys.stderr.flush()
    NamedTupleDocs = doctest.DocTestSuite(module=collections)
    test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs]
    test_support.run_unittest(*test_classes)
    test_support.run_doctest(collections, verbose)
开发者ID:andrcmdr,项目名称:unladen-swallow,代码行数:8,代码来源:test_collections.py

示例10: test_main

def test_main():
    test_support.run_unittest(
        PickleTests,
        PicklerTests,
        PersPicklerTests,
        PicklerUnpicklerObjectTests,
        PickleBigmemPickleTests,
    )
    test_support.run_doctest(pickle)
开发者ID:mxxu,项目名称:pyston,代码行数:9,代码来源:test_pickle.py

示例11: test_main

def test_main():
    test_support.run_unittest(SyntaxTestCase)

    if test_support.due_to_ironpython_bug("http://ironpython.codeplex.com/workitem/28171"):
        return
    from test import test_syntax

    with test_support.check_py3k_warnings(("backquote not supported", SyntaxWarning)):
        test_support.run_doctest(test_syntax, verbosity=True)
开发者ID:jschementi,项目名称:iron,代码行数:9,代码来源:test_syntax.py

示例12: test_main

def test_main(verbose=None):
    import doctest
    from test import test_support, test_generators
    if 0:   # change to 1 to run forever (to check for leaks)
        while 1:
            doctest.master = None
            test_support.run_doctest(test_generators, verbose)
            print ".",
    else:
        test_support.run_doctest(test_generators, verbose)
开发者ID:OS2World,项目名称:APP-INTERNET-torpak_2,代码行数:10,代码来源:test_generators.py

示例13: test_main

def test_main():
    test_support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        SubclassableWeakrefTestCase,
        )
    if not test_support.due_to_ironpython_bug("http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=21116"):
        test_support.run_doctest(sys.modules[__name__])
开发者ID:BillyboyD,项目名称:main,代码行数:10,代码来源:test_weakref.py

示例14: test_main

def test_main(arith=False, 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()
    global TEST_ALL, DEBUG
    TEST_ALL = arith or is_resource_enabled("decimal")
    DEBUG = debug

    if todo_tests is None:
        test_classes = [
            DecimalExplicitConstructionTest,
            DecimalImplicitConstructionTest,
            DecimalArithmeticOperatorsTest,
            DecimalFormatTest,
            DecimalUseOfContextTest,
            DecimalUsabilityTest,
            DecimalPythonAPItests,
            ContextAPItests,
            DecimalTest,
            WithStatementTest,
            ContextFlags,
        ]
    else:
        test_classes = [DecimalTest]

    # 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(DecimalTest, "test_" + head, tester)
        del filename, head, tail, tester

    try:
        run_unittest(*test_classes)
        if todo_tests is None:
            import decimal as DecimalModule

            run_doctest(DecimalModule, verbose)
    finally:
        setcontext(ORIGINAL_CONTEXT)
开发者ID:harry159821,项目名称:sl4a,代码行数:50,代码来源:test_decimal.py

示例15: test_main

def test_main(verbose=None):
    import sys
    from test import test_support
    from test import test_genexps
    test_support.run_doctest(test_genexps, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in xrange(len(counts)):
            test_support.run_doctest(test_genexps, verbose)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print counts
开发者ID:enyst,项目名称:plexnet,代码行数:15,代码来源:test_genexps.py


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