# deterministic.
from test.support import sortdict
-import pprint
import doctest
import unittest
You can get the information from the list type:
+ >>> import pprint
>>> pprint.pprint(dir(list)) # like list.__dict__.keys(), but sorted
['__add__',
'__class__',
from test import support
from test.support import import_helper
-from test.support import os_helper
import doctest
import functools
import os
import importlib.util
import unittest
import tempfile
-import shutil
import types
import contextlib
>>> tests = finder.find(sample_func)
>>> print(tests) # doctest: +ELLIPSIS
- [<DocTest sample_func from test_doctest.py:34 (1 example)>]
+ [<DocTest sample_func from test_doctest.py:32 (1 example)>]
The exact name depends on how test_doctest was invoked, so allow for
leading path components.
at least one of the line endings will raise a ValueError for inconsistent
whitespace if doctest does not correctly do the newline conversion.
+ >>> from test.support import os_helper
+ >>> import shutil
>>> dn = tempfile.mkdtemp()
>>> pkg = os.path.join(dn, "doctest_testpkg")
>>> os.mkdir(pkg)
We're defining four helper functions
+ >>> from test import support
>>> def e(a,b):
... print(a, b)
import doctest
import unittest
-from test import support
def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite())