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


Python support.run_doctest函数代码示例

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


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

示例1: 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:Kanma,项目名称:Athena-Dependencies-Python,代码行数:35,代码来源:test_getopt.py

示例2: test_main

def test_main():
    from test import test_tokenize
    support.run_doctest(test_tokenize, True)
    support.run_unittest(TestTokenizerAdheresToPep0263)
    support.run_unittest(Test_Tokenize)
    support.run_unittest(TestDetectEncoding)
    support.run_unittest(TestTokenize)
开发者ID:ChowZenki,项目名称:kbengine,代码行数:7,代码来源:test_tokenize.py

示例3: test_main

def test_main(verbose=None):
    from test import test_code
    run_doctest(test_code, verbose)
    tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
    if check_impl_detail(cpython=True) and ctypes is not None:
        tests.append(CoExtra)
    run_unittest(*tests)
开发者ID:1st1,项目名称:cpython,代码行数:7,代码来源:test_code.py

示例4: test_main

def test_main():
    tests = [
        PickleTests,
        PyUnpicklerTests,
        PyPicklerTests,
        PyPersPicklerTests,
        PyDispatchTableTests,
        PyChainDispatchTableTests,
        CompatPickleTests,
    ]
    if has_c_implementation:
        tests.extend(
            [
                CUnpicklerTests,
                CPicklerTests,
                CPersPicklerTests,
                CDumpPickle_LoadPickle,
                DumpPickle_CLoadPickle,
                PyPicklerUnpicklerObjectTests,
                CPicklerUnpicklerObjectTests,
                CDispatchTableTests,
                CChainDispatchTableTests,
                InMemoryPickleTests,
                SizeofTests,
            ]
        )
    support.run_unittest(*tests)
    support.run_doctest(pickle)
开发者ID:stan2133,项目名称:cpython,代码行数:28,代码来源:test_pickle.py

示例5: test_main

def test_main(verbose=None):
    import sys
    test_classes = (
        TestBasic,
        TestVariousIteratorArgs,
        TestSubclass,
        TestSubclassWithKwargs,
        TestSequence,
    )

    support.run_unittest(*test_classes)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in range(len(counts)):
            support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print(counts)

    # doctests
    from test import test_deque
    support.run_doctest(test_deque, verbose)
开发者ID:FFMG,项目名称:myoddweb.piger,代码行数:25,代码来源:test_deque.py

示例6: 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 support, test_descrtut
    support.run_doctest(test_descrtut, verbose)
开发者ID:Anzumana,项目名称:cpython,代码行数:8,代码来源:test_descrtut.py

示例7: test_main

def test_main():
    tests = [PickleTests, PyPicklerTests, PyPersPicklerTests]
    if has_c_implementation:
        tests.extend([CPicklerTests, CPersPicklerTests,
                      CDumpPickle_LoadPickle, DumpPickle_CLoadPickle,
                      PyPicklerUnpicklerObjectTests,
                      CPicklerUnpicklerObjectTests])
    support.run_unittest(*tests)
    support.run_doctest(pickle)
开发者ID:Kanma,项目名称:Athena-Dependencies-Python,代码行数:9,代码来源:test_pickle.py

示例8: test_main

def test_main():
    support.run_unittest(
        ReferencesTestCase,
        MappingTestCase,
        WeakValueDictionaryTestCase,
        WeakKeyDictionaryTestCase,
        SubclassableWeakrefTestCase,
        )
    support.run_doctest(sys.modules[__name__])
开发者ID:wdv4758h,项目名称:ZipPy,代码行数:9,代码来源:test_weakref.py

示例9: test_main

def test_main(verbose=None):
    from test import test_urllib2
    support.run_doctest(test_urllib2, verbose)
    support.run_doctest(urllib.request, verbose)
    tests = (TrivialTests,
             OpenerDirectorTests,
             HandlerTests,
             MiscTests)
    support.run_unittest(*tests)
开发者ID:LinkedModernismProject,项目名称:web_code,代码行数:9,代码来源:test_urllib2.py

示例10: test_main

def test_main():
    from test import test_xml_etree, test_xml_etree_c

    # Run the tests specific to the C implementation
    support.run_doctest(test_xml_etree_c, verbosity=True)
    support.run_unittest(
        MiscTests,
        TestAliasWorking,
        TestAcceleratorImported
        )

    # Run the same test suite as the Python module
    test_xml_etree.test_main(module=cET)
开发者ID:Naddiseo,项目名称:cpython,代码行数:13,代码来源:test_xml_etree_c.py

示例11: test_main

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

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

示例12: test_main

def test_main():
    from test import test_doctest2
    EXPECTED = 19
    f, t = support.run_doctest(test_doctest2)
    if t != EXPECTED:
        raise support.TestFailed("expected %d tests to run, not %d" %
                                      (EXPECTED, t))
开发者ID:5outh,项目名称:Databases-Fall2014,代码行数:7,代码来源:test_doctest2.py

示例13: test_main

def test_main():
    from test import test_xml_etree, test_xml_etree_c

    # Run the tests specific to the C implementation
    support.run_doctest(test_xml_etree_c, verbosity=True)

    # Assign the C implementation before running the doctests
    # Patch the __name__, to prevent confusion with the pure Python test
    pyET = test_xml_etree.ET
    py__name__ = test_xml_etree.__name__
    test_xml_etree.ET = cET
    if __name__ != '__main__':
        test_xml_etree.__name__ = __name__
    try:
        # Run the same test suite as xml.etree.ElementTree
        test_xml_etree.test_main(module_name='xml.etree.cElementTree')
    finally:
        test_xml_etree.ET = pyET
        test_xml_etree.__name__ = py__name__
开发者ID:pogigroo,项目名称:py3k-__format__,代码行数:19,代码来源:test_xml_etree_c.py

示例14: test_main

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

    test_classes = [TestBisectPython, TestBisectC,
                    TestInsortPython, TestInsortC,
                    TestErrorHandlingPython, TestErrorHandlingC]

    support.run_unittest(*test_classes)
    support.run_doctest(test_bisect, verbose)

    # verify reference counting
    if verbose and hasattr(sys, "gettotalrefcount"):
        import gc
        counts = [None] * 5
        for i in range(len(counts)):
            support.run_unittest(*test_classes)
            gc.collect()
            counts[i] = sys.gettotalrefcount()
        print(counts)
开发者ID:AndyPanda95,项目名称:python-for-android,代码行数:19,代码来源:test_bisect.py

示例15: test_main

def test_main(verbose=False):
    import sys
    from test import support
    from test import test_unpack_ex
    support.run_doctest(test_unpack_ex, verbose)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:5,代码来源:test_unpack_ex.py


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