class doctest.DocTest(examples, globs, name, filename, lineno, docstring)
A collection of doctest examples that should be run in a single namespace. The constructor arguments are used to initialize the attributes of the same names.
DocTest defines the following attributes. They are initialized by the constructor, and should not be modified directly.
-
examples -
A list of
Exampleobjects encoding the individual interactive Python examples that should be run by this test.
-
globs -
The namespace (aka globals) that the examples should be run in. This is a dictionary mapping names to values. Any changes to the namespace made by the examples (such as binding new variables) will be reflected in
globsafter the test is run.
-
name -
A string name identifying the
DocTest. Typically, this is the name of the object or file that the test was extracted from.
-
filename -
The name of the file that this
DocTestwas extracted from; orNoneif the filename is unknown, or if theDocTestwas not extracted from a file.
-
lineno -
The line number within
filenamewhere thisDocTestbegins, orNoneif the line number is unavailable. This line number is zero-based with respect to the beginning of the file.
-
docstring -
The string that the test was extracted from, or ‘None’ if the string is unavailable, or if the test was not extracted from a string.
Please login to continue.