scipy_doctest.impl.DTConfig¶
- class scipy_doctest.impl.DTConfig(*, CheckerKlass=None, default_namespace=None, check_namespace=None, rndm_markers=None, atol=1e-08, rtol=0.01, strict_check=False, optionflags=None, stopwords=None, pseudocode=None, skiplist=None, user_context_mgr=None, local_resources=None, parse_namedtuples=True, nameerror_after_exception=False, pytest_extra_ignore=None, pytest_extra_skip=None, pytest_extra_xfail=None)¶
A bag class to collect various configuration bits.
If an attribute is None, helpful defaults are subsituted. If defaults are not sufficient, users should create an instance of this class, override the desired attributes and pass the instance to
testmod
.- default_namespace¶
The namespace to run examples in.
- Type:
dict
- check_namespace¶
The namespace to do checks in.
- Type:
dict
- rndm_markers¶
Additional directives which act like
# doctest: + SKIP
.- Type:
set
- atol¶
- Type:
float
- rtol¶
Absolute and relative tolerances to check doctest examples with. Specifically, the check is
np.allclose(want, got, atol=atol, rtol=rtol)
- Type:
float
- strict_check¶
Whether to check that dtypes match or rely on the lax definition of equality of numpy objects. For instance,
3 == np.float64(3)
, but dtypes do not match. Default is False.- Type:
bool
- optionflags¶
doctest optionflags Default is
NORMALIZE_WHITESPACE | ELLIPSIS | IGNORE_EXCEPTION_DETAIL
- Type:
int
- stopwords¶
If an example contains any of these stopwords, do not check the output (but do check that the source is valid python).
- Type:
set
- pseudocode¶
List of strings. If an example contains any of these substrings, it is not doctested at all. This is similar to the
# doctest +SKIP
directive. Typical candidates for this list are pseudocode blocks>>> from example import some_function
or some such.- Type:
list
- skiplist¶
A list of names of objects whose docstrings are known to fail doctesting and we like to keep it that way.
- Type:
set
- user_context_mgr¶
A context manager to run tests in. Is entered for each DocTest (for API docs, this is typically a single docstring). The operation is roughly
>>> for test in tests: ... with user_context(test): ... runner.run(test)
Default is a noop.
- local_resources¶
If a test needs some local files, list them here. The format is
{test.name : list-of-files}
File paths are relative to path oftest.filename
.- Type:
dict
- parse_namedtuples¶
Whether to compare e.g.
TTestResult(pvalue=0.9, statistic=42)
literally or extract the numbers and compare the tuple(0.9, 42)
. Default is True.- Type:
bool
- nameerror_after_exception¶
If an example fails, next examples in the same test may raise spurious NameErrors. Set to True if you want to see these, or if your test is actually expected to raise NameErrors. Default is False.
- Type:
bool
- pytest_extra_ignore¶
A list of names/modules to ignore when run under pytest plugin. This is equivalent to using
--ignore=...
cmdline switch.- Type:
list
- pytest_extra_skip¶
Names/modules to skip when run under pytest plugin. This is equivalent to decorating the doctest with
@pytest.mark.skip
or adding# doctest: + SKIP
to its examples. Each key is a doctest name to skip, and the corresponding value is a string. If not empty, the string value is used as the skip reason.- Type:
dict
- pytest_extra_xfail¶
Names/modules to xfail when run under pytest plugin. This is equivalent to decorating the doctest with
@pytest.mark.xfail
or adding# may vary
to the outputs of all examples. Each key is a doctest name to skip, and the corresponding value is a string. If not empty, the string value is used as the skip reason.- Type:
dict
- CheckerKlass¶
The class for the Checker object. Must mimic the
DTChecker
API: subclass thedoctest.OutputChecker
and make the constructor signature read__init__(self, config=None)
, whereconfig
is aDTConfig
instance. This class will be instantiated byDTRunner
. Defaults toDTChecker
.- Type:
object, optional
- __init__(*, CheckerKlass=None, default_namespace=None, check_namespace=None, rndm_markers=None, atol=1e-08, rtol=0.01, strict_check=False, optionflags=None, stopwords=None, pseudocode=None, skiplist=None, user_context_mgr=None, local_resources=None, parse_namedtuples=True, nameerror_after_exception=False, pytest_extra_ignore=None, pytest_extra_skip=None, pytest_extra_xfail=None)¶
Methods
__init__
(*[, CheckerKlass, ...])