Python doctest.DocTestSuite() Examples
The following are 30
code examples of doctest.DocTestSuite().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
doctest
, or try the search function
.
Example #1
Source File: test_doctests.py From n6 with GNU Affero General Public License v3.0 | 6 votes |
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)
Example #2
Source File: test_threading_local.py From BinderFilter with MIT License | 6 votes |
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)
Example #3
Source File: httputil.py From teleport with Apache License 2.0 | 5 votes |
def doctests(): import doctest return doctest.DocTestSuite()
Example #4
Source File: test_doctests.py From cot with MIT License | 5 votes |
def load_tests(*_): """Load doctests as unittest test suite. For the parameters, see :mod:`unittest`. The parameters are unused here. """ suite = TestSuite() suite.addTests(DocTestSuite('COT.commands.add_disk')) suite.addTests(DocTestSuite('COT.commands.deploy')) suite.addTests(DocTestSuite('COT.commands.edit_hardware')) suite.addTests(DocTestSuite('COT.commands.edit_properties')) return suite
Example #5
Source File: test_classification_based.py From kenchi with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(classification_based)) return tests
Example #6
Source File: test_distance_based.py From kenchi with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(distance_based)) return tests
Example #7
Source File: test_statistical.py From kenchi with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(statistical)) return tests
Example #8
Source File: test.py From Hatkey with GNU General Public License v3.0 | 5 votes |
def doctest_suite(module_names): """Makes a test suite from doctests.""" suite = TestSuite() for mod in load_modules(module_names): suite.addTest(doctest.DocTestSuite(mod, checker=Py23DocChecker())) return suite
Example #9
Source File: test_doctests.py From cot with MIT License | 5 votes |
def load_tests(*_): """Load doctests as unittest test suite. For the parameters, see :mod:`unittest`. The parameters are unused here. """ suite = TestSuite() suite.addTests(DocTestSuite('COT.vm_description.ovf.item')) suite.addTests(DocTestSuite('COT.vm_description.ovf.utilities')) return suite
Example #10
Source File: test_doctests.py From cot with MIT License | 5 votes |
def load_tests(*_): """Load doctests as unittest test suite. For the parameters, see :mod:`unittest`. The parameters are unused here. """ suite = TestSuite() suite.addTests(DocTestSuite('COT.data_validation')) suite.addTests(DocTestSuite('COT.utilities')) return suite
Example #11
Source File: test_doctests.py From cot with MIT License | 5 votes |
def load_tests(*_): """Load doctests as unittest test suite. For the parameters, see :mod:`unittest`. The parameters are unused here. """ suite = TestSuite() suite.addTests(DocTestSuite('COT.ui.cli')) return suite
Example #12
Source File: test_reconstruction_based.py From kenchi with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(reconstruction_based)) return tests
Example #13
Source File: httputil.py From teleport with Apache License 2.0 | 5 votes |
def doctests(): # type: () -> unittest.TestSuite import doctest return doctest.DocTestSuite()
Example #14
Source File: util.py From teleport with Apache License 2.0 | 5 votes |
def doctests(): # type: () -> unittest.TestSuite import doctest return doctest.DocTestSuite()
Example #15
Source File: httputil.py From teleport with Apache License 2.0 | 5 votes |
def doctests(): # type: () -> unittest.TestSuite import doctest return doctest.DocTestSuite()
Example #16
Source File: iostream.py From teleport with Apache License 2.0 | 5 votes |
def doctests(): import doctest return doctest.DocTestSuite()
Example #17
Source File: util.py From teleport with Apache License 2.0 | 5 votes |
def doctests(): import doctest return doctest.DocTestSuite()
Example #18
Source File: iostream.py From teleport with Apache License 2.0 | 5 votes |
def doctests() -> Any: import doctest return doctest.DocTestSuite()
Example #19
Source File: runner.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def loadDoctests(self, module): """ Return a suite of tests for all the doctests defined in C{module}. @param module: A module object or a module name. """ if isinstance(module, str): try: module = reflect.namedAny(module) except: return ErrorHolder(module, failure.Failure()) if not inspect.ismodule(module): warnings.warn("trial only supports doctesting modules") return extraArgs = {} if sys.version_info > (2, 4): # Work around Python issue2604: DocTestCase.tearDown clobbers globs def saveGlobals(test): """ Save C{test.globs} and replace it with a copy so that if necessary, the original will be available for the next test run. """ test._savedGlobals = getattr(test, '_savedGlobals', test.globs) test.globs = test._savedGlobals.copy() extraArgs['setUp'] = saveGlobals return doctest.DocTestSuite(module, **extraArgs)
Example #20
Source File: test_import_interfaces.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_suite(): return unittest.TestSuite(( doctest.DocTestSuite(), ))
Example #21
Source File: test_odd_declarations.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_suite(): import doctest suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test)) suite.addTest(doctest.DocTestSuite(odd)) return suite
Example #22
Source File: test_interface.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_suite(): import doctest return unittest.TestSuite(( unittest.makeSuite(ElementTests), unittest.makeSuite(SpecificationBasePyTests), unittest.makeSuite(InterfaceBasePyTests), unittest.makeSuite(SpecificationTests), unittest.makeSuite(InterfaceTests), unittest.makeSuite(AttributeTests), unittest.makeSuite(MethodTests), unittest.makeSuite(Test_fromFunction), #unittest.makeSuite(Test_fromMethod), doctest.DocTestSuite(), doctest.DocTestSuite("zope.interface.interface"), ))
Example #23
Source File: sample_doctest.py From oss-ftp with MIT License | 5 votes |
def test_suite(): import doctest return doctest.DocTestSuite()
Example #24
Source File: test_collections.py From oss-ftp with MIT License | 5 votes |
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)
Example #25
Source File: test_difflib.py From oss-ftp with MIT License | 5 votes |
def test_main(): difflib.HtmlDiff._default_prefix = 0 Doctests = doctest.DocTestSuite(difflib) run_unittest( TestWithAscii, TestAutojunk, TestSFpatches, TestSFbugs, TestOutputFormat, Doctests)
Example #26
Source File: test_sets.py From oss-ftp with MIT License | 5 votes |
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), )
Example #27
Source File: __init__.py From oss-ftp with MIT License | 5 votes |
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
Example #28
Source File: test_versionpredicate.py From oss-ftp with MIT License | 5 votes |
def test_suite(): return doctest.DocTestSuite(distutils.versionpredicate)
Example #29
Source File: util.py From viewfinder with Apache License 2.0 | 5 votes |
def doctests(): import doctest return doctest.DocTestSuite()
Example #30
Source File: httputil.py From viewfinder with Apache License 2.0 | 5 votes |
def doctests(): import doctest return doctest.DocTestSuite()