當前位置: 首頁>>代碼示例>>Python>>正文


Python doctest.DocTestSuite方法代碼示例

本文整理匯總了Python中doctest.DocTestSuite方法的典型用法代碼示例。如果您正苦於以下問題:Python doctest.DocTestSuite方法的具體用法?Python doctest.DocTestSuite怎麽用?Python doctest.DocTestSuite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在doctest的用法示例。


在下文中一共展示了doctest.DocTestSuite方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_main

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_main():
    suite = unittest.TestSuite()
    suite.addTest(DocTestSuite('_threading_local'))
    suite.addTest(unittest.makeSuite(ThreadLocalTest))
    suite.addTest(unittest.makeSuite(PyThreadingLocalTest))

    try:
        from thread import _local
    except ImportError:
        pass
    else:
        import _threading_local
        local_orig = _threading_local.local
        def setUp(test):
            _threading_local.local = _local
        def tearDown(test):
            _threading_local.local = local_orig
        suite.addTest(DocTestSuite('_threading_local',
                                   setUp=setUp, tearDown=tearDown)
                      )

    test_support.run_unittest(suite) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:24,代碼來源:test_threading_local.py

示例2: load_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, *args):
    for _, name, _ in pkgutil.walk_packages(n6sdk._ABS_PATH):
        try:
            mod_suite = doctest.DocTestSuite(name)
        except ValueError as exc:
            try:
                msg = getattr(exc, 'args', ())[1]
            except (IndexError, TypeError):
                msg = None
            if msg != 'has no tests':
                raise
        else:
            tests.addTests(mod_suite)
    return tests


# dissuade nose from using that function
# (note that nose has its own ways to discover doctests) 
開發者ID:CERT-Polska,項目名稱:n6,代碼行數:20,代碼來源:test_doctests.py

示例3: make_suite

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def make_suite():  # pragma: no cover
    import calmjs.registry
    test_loader = unittest.TestLoader()
    test_suite = test_loader.discover(
        'calmjs.tests', pattern='test_*.py',
        top_level_dir=dirname(__file__),
    )
    # setting up the finder is a bit annoying for just a one-off.
    test_suite.addTest(doctest.DocTestSuite(calmjs.registry))
    return test_suite 
開發者ID:calmjs,項目名稱:calmjs,代碼行數:12,代碼來源:__init__.py

示例4: doctests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def doctests():
    import doctest
    return doctest.DocTestSuite() 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:5,代碼來源:httputil.py

示例5: load_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
    tests.addTests(DocTestSuite(knx))
    return tests 
開發者ID:mfussenegger,項目名稱:knx,代碼行數:5,代碼來源:tests.py

示例6: additional_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:12,代碼來源:__init__.py

示例7: load_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
    # Add the doctests
    tests.addTests(DocTestSuite('more_itertools.recipes'))
    return tests 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:6,代碼來源:test_recipes.py

示例8: load_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
    # Add the doctests
    tests.addTests(DocTestSuite('more_itertools.more'))
    return tests 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:6,代碼來源:test_more.py

示例9: load_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
    tests.addTests(doctest.DocTestSuite(corpus))
    return tests 
開發者ID:alvations,項目名稱:sacremoses,代碼行數:5,代碼來源:test_corpus.py

示例10: test_suite

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_suite():
    return doctest.DocTestSuite() 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:4,代碼來源:test_regression.py

示例11: load_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
    tests.addTests(doctest.DocTestSuite(doctest_module))
    return tests 
開發者ID:PacktPublishing,項目名稱:Clean-Code-in-Python,代碼行數:5,代碼來源:doctest_module_test.py

示例12: test_suite

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_suite():
    return doctest.DocTestSuite(distutils.versionpredicate) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:4,代碼來源:test_versionpredicate.py

示例13: additional_tests

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def additional_tests():
    suite = unittest.TestSuite()
    for mod in (json, json.encoder, json.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(TestPyTest('test_pyjson'))
    suite.addTest(TestCTest('test_cjson'))
    return suite 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:__init__.py

示例14: test_main

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_main(verbose=None):
    import doctest
    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,
        TestOnlySetsofSets,
        TestCopyingEmpty,
        TestCopyingSingleton,
        TestCopyingTriple,
        TestCopyingTuple,
        TestCopyingNested,
        TestIdentities,
        doctest.DocTestSuite(test_sets),
    ) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:35,代碼來源:test_sets.py

示例15: test_main

# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_main():
    difflib.HtmlDiff._default_prefix = 0
    Doctests = doctest.DocTestSuite(difflib)
    run_unittest(
        TestWithAscii, TestAutojunk, TestSFpatches, TestSFbugs,
        TestOutputFormat, TestJunkAPIs) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:8,代碼來源:test_difflib.py


注:本文中的doctest.DocTestSuite方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。