Developpez.com

Python

Choisissez la catégorie, puis la rubrique :

23.2.6.1 DocTest Objects


23.2.6.1 DocTest Objects

class 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 member variables of the same names. New in version 2.4.

DocTest defines the following member variables. They are initialized by the constructor, and should not be modified directly.

examples
A list of Example objects 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 globs after 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 DocTest was extracted from; or None if the filename is unknown, or if the DocTest was not extracted from a file.

lineno
The line number within filename where this DocTest begins, or None if 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.

See About this document... for information on suggesting changes.
Microsoft publie l'édition de juin 2019 de l'extension Python pour Visual Studio Code, elle inclut 70 correctifs et son lot de nouveautés
Le neuvième week-end de programmation de jeux vidéo sur Developpez.com
Programmation : une étude révèle les langages les plus voraces en énergie, Perl, Python et Ruby en tête, C, Rust et C++, les langages les plus verts
Apprendre les notions avancées en Cython, un tutoriel de Gabor Laszlo Hajba traduit par l'équipe de rédaction
Contacter le responsable de la rubrique Python

Partenaire : Hébergement Web