本文整理汇总了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)