sdk/python/Testing/PyDoctest
Testing

PyDoctest

Python stdlib module — doctest. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

Other Methods

.DocFileSuite()Neutral
#
Signature
DocFileSuite(paths, kw)

A unittest suite for one or more doctest files.

.DocFileTest()Neutral
#
Signature
DocFileTest(path, module_relative, package, globs, parser, encoding, options)

DocFileTest function.

.DocTestSuite()Neutral
#
Signature
DocTestSuite(module, globs, extraglobs, test_finder, options)

Convert doctest tests for a module to a unittest test suite.

.debug()Neutral
#
Signature
debug(module, name, pm)

Debug a single doctest docstring.

.debug_script()Neutral
#
Signature
debug_script(src, pm, globs)

Debug a test script. `src` is the script, as a string.

.debug_src()Neutral
#
Signature
debug_src(src, pm, globs)

Debug a single doctest docstring, in argument `src`'

.namedtuple()Neutral
#
Signature
namedtuple(typename, field_names, rename, defaults, module)

Returns a new subclass of tuple with named fields.

.register_optionflag()Neutral
#
Signature
register_optionflag(name)

register_optionflag function.

.run_docstring_examples()Neutral
#
Signature
run_docstring_examples(f, globs, verbose, name, compileflags, optionflags)

Test examples in the given object's docstring (`f`), using `globs`

.script_from_examples()Neutral
#
Signature
script_from_examples(s)

Extract script from text with examples.

Fully-Qualified Names

FQNField
doctestfqns[0]

Wrong FQN → 0 findings. Verify with: change fqns to garbage → must produce 0 results.

Import

rule.py
import doctest