本文整理匯總了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)
示例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)
示例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
示例4: doctests
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def doctests():
import doctest
return doctest.DocTestSuite()
示例5: load_tests
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
tests.addTests(DocTestSuite(knx))
return tests
示例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
示例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
示例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
示例9: load_tests
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(corpus))
return tests
示例10: test_suite
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_suite():
return doctest.DocTestSuite()
示例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
示例12: test_suite
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import DocTestSuite [as 別名]
def test_suite():
return doctest.DocTestSuite(distutils.versionpredicate)
示例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
示例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),
)
示例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)