Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « doctest » Python 3.13.2

Classe « Example »

Informations générales

Héritage

builtins.object
    Example

Définition

class Example(builtins.object):

help(Example)

A single doctest example, consisting of source code and expected
output.  `Example` defines the following attributes:

  - source: A single Python statement, always ending with a newline.
    The constructor adds a newline if needed.

  - want: The expected output from running the source code (either
    from stdout, or a traceback in case of exception).  `want` ends
    with a newline unless it's empty, in which case it's an empty
    string.  The constructor adds a newline if needed.

  - exc_msg: The exception message generated by the example, if
    the example is expected to generate an exception; or `None` if
    it is not expected to generate an exception.  This exception
    message is compared against the return value of
    `traceback.format_exception_only()`.  `exc_msg` ends with a
    newline unless it's `None`.  The constructor adds a newline
    if needed.

  - lineno: The line number within the DocTest string containing
    this Example where the Example begins.  This line number is
    zero-based, with respect to the beginning of the DocTest.

  - indent: The example's indentation in the DocTest string.
    I.e., the number of space characters that precede the
    example's first prompt.

  - options: A dictionary mapping from option flags to True or
    False, which is used to override default options for this
    example.  Any option flags not contained in this dictionary
    are left at their default value (as specified by the
    DocTestRunner's optionflags).  By default, no options are set.

Constructeur(s)

Signature du constructeur Description
__init__(self, source, want, exc_msg=None, lineno=0, indent=0, options=None)

Liste des opérateurs

Signature de l'opérateur Description
__eq__(self, other)

Opérateurs hérités de la classe object

__ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__hash__(self)

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __init_subclass__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé