1
0
Fork 0
python-docs-fr/library/doctest.po

2766 lines
119 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Copyright (C) 2001-2018, Python Software Foundation
# For licence information, see README file.
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-15 22:33+0100\n"
"PO-Revision-Date: 2021-09-12 09:38-0400\n"
"Last-Translator: Edith Viau <info@eviau.net>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3\n"
#: library/doctest.rst:2
msgid ":mod:`doctest` --- Test interactive Python examples"
msgstr ":mod:`doctest` — Exemples de tests interactifs en Python"
#: library/doctest.rst:12
msgid "**Source code:** :source:`Lib/doctest.py`"
msgstr "**Code source :** :source:`Lib/doctest.py`"
#: library/doctest.rst:16
msgid ""
"The :mod:`doctest` module searches for pieces of text that look like "
"interactive Python sessions, and then executes those sessions to verify that "
"they work exactly as shown. There are several common ways to use doctest:"
msgstr ""
"Le module :mod:`doctest` cherche des extraits de texte ressemblant à des "
"sessions Python interactives avant de les exécuter, de façon à vérifier que "
"le fonctionnement correspond exactement à la description. Voici quelques cas "
"d'utilisation de *doctest* :"
#: library/doctest.rst:20
msgid ""
"To check that a module's docstrings are up-to-date by verifying that all "
"interactive examples still work as documented."
msgstr ""
"Vérifier que les *docstrings* d'un module sont à jour en vérifiant que tous "
"les exemples interactifs fonctionnent toujours tels que décrits."
#: library/doctest.rst:23
msgid ""
"To perform regression testing by verifying that interactive examples from a "
"test file or a test object work as expected."
msgstr ""
"Réaliser un test de régression en vérifiant que les exemples interactifs "
"provenant d'un fichier de test ou d'un objet de test fonctionnent comme "
"prévu."
#: library/doctest.rst:26
msgid ""
"To write tutorial documentation for a package, liberally illustrated with "
"input-output examples. Depending on whether the examples or the expository "
"text are emphasized, this has the flavor of \"literate testing\" or "
"\"executable documentation\"."
msgstr ""
"Rédiger de la documentation sous forme de tutoriel pour un paquet, avec une "
"abondance d'exemples ayant des entrées et des sorties. On pourrait voir ça "
"comme des tests « dans le texte » ou de la « documentation exécutable », "
"selon le point de vue."
#: library/doctest.rst:31
msgid "Here's a complete but small example module::"
msgstr "Voici un petit exemple d'un module qui soit tout de même complet ::"
#: library/doctest.rst:88
msgid ""
"If you run :file:`example.py` directly from the command line, :mod:`doctest` "
"works its magic:"
msgstr ""
"L'exécution du fichier :file:`example.py` directement à partir de la ligne "
"de commande démontre la magie de :mod:`doctest` :"
#: library/doctest.rst:96
msgid ""
"There's no output! That's normal, and it means all the examples worked. "
"Pass ``-v`` to the script, and :mod:`doctest` prints a detailed log of what "
"it's trying, and prints a summary at the end:"
msgstr ""
"Il n'y a pas de sortie ! C'est normal, cela signifie que tous les exemples "
"fonctionnent. Passez ``-v`` au script pour que :mod:`doctest` affiche un "
"journal détaillé de ce qui a été essayé, avant d'afficher un résumé à la "
"fin :"
#: library/doctest.rst:114
msgid "And so on, eventually ending with:"
msgstr "Et ainsi de suite, jusqu'à ce qu'on atteigne :"
#: library/doctest.rst:133
msgid ""
"That's all you need to know to start making productive use of :mod:"
"`doctest`! Jump in. The following sections provide full details. Note that "
"there are many examples of doctests in the standard Python test suite and "
"libraries. Especially useful examples can be found in the standard test "
"file :file:`Lib/test/test_doctest.py`."
msgstr ""
"C'est tout ce dont vous avez besoin pour pouvoir commencer une utilisation "
"productive de :mod:`doctest` ! Allez-y. Les sections suivantes donnent tous "
"les détails. Notez qu'il y a plusieurs exemples de *doctests* dans la suite "
"de tests de la bibliothèque standard de Python et dans les autres "
"bibliothèques. Des exemples particulièrement utiles se situent dans le "
"fichier de test standard :file:`Lib/test/test_doctest.py`."
#: library/doctest.rst:143
msgid "Simple Usage: Checking Examples in Docstrings"
msgstr "Utilisation simple : vérifier des exemples dans des *docstrings*"
#: library/doctest.rst:145
msgid ""
"The simplest way to start using doctest (but not necessarily the way you'll "
"continue to do it) is to end each module :mod:`M` with::"
msgstr ""
"Le plus simple pour commencer à utiliser *doctest* (mais pas nécessairement "
"la façon avec laquelle vous continuerez) est de terminer chaque module :mod:"
"`M` avec ::"
#: library/doctest.rst:152
msgid ":mod:`doctest` then examines docstrings in module :mod:`M`."
msgstr ":mod:`doctest` examine alors les *docstrings* dans le module :mod:`M`."
#: library/doctest.rst:154
msgid ""
"Running the module as a script causes the examples in the docstrings to get "
"executed and verified::"
msgstr ""
"Exécuter le module comme un script a comme conséquence d'exécuter et de "
"vérifier les exemples dans les *docstrings* ::"
#: library/doctest.rst:159
msgid ""
"This won't display anything unless an example fails, in which case the "
"failing example(s) and the cause(s) of the failure(s) are printed to stdout, "
"and the final line of output is ``***Test Failed*** N failures.``, where *N* "
"is the number of examples that failed."
msgstr ""
"Ceci n'affiche rien à moins qu'un exemple échoue ; le cas échéant, les "
"exemples défaillants et les causes du ou des échecs sont affichés sur "
"*stdout*, et la ligne finale de la sortie est ``***Test Failed*** *N "
"failures*.``, où *N* est le nombre d'exemples défaillants."
#: library/doctest.rst:164
msgid "Run it with the ``-v`` switch instead::"
msgstr "À la place, exécutez-la avec l'option de ligne de commande ``-v`` ::"
#: library/doctest.rst:168
msgid ""
"and a detailed report of all examples tried is printed to standard output, "
"along with assorted summaries at the end."
msgstr ""
"alors, un rapport détaillé de tous les exemples faisant partie de l'essai "
"est affiché sur la sortie standard, accompagné à la fin de leurs résumés."
#: library/doctest.rst:171
msgid ""
"You can force verbose mode by passing ``verbose=True`` to :func:`testmod`, "
"or prohibit it by passing ``verbose=False``. In either of those cases, "
"``sys.argv`` is not examined by :func:`testmod` (so passing ``-v`` or not "
"has no effect)."
msgstr ""
"Vous pouvez activer le mode verbeux en passant ``verbose=True`` à :func:"
"`testmod`, ou vous le désactiver en lui passant ``verbose=False``. Dans ces "
"deux cas, ``sys.argv`` n'est pas inspecté par :func:`testmod` (ainsi, lui "
"passer ``-v`` ou pas n'a aucun effet)."
#: library/doctest.rst:176
msgid ""
"There is also a command line shortcut for running :func:`testmod`. You can "
"instruct the Python interpreter to run the doctest module directly from the "
"standard library and pass the module name(s) on the command line::"
msgstr ""
"Il y a un raccourci pour exécuter :func:`testmod` à partir de la ligne de "
"commande. Vous demandez à l'interpréteur Python d'exécuter le module "
"*doctest* directement à partir de la bibliothèque standard afin de passer le "
"ou les noms des modules à partir de la ligne de commande ainsi ::"
#: library/doctest.rst:182
msgid ""
"This will import :file:`example.py` as a standalone module and run :func:"
"`testmod` on it. Note that this may not work correctly if the file is part "
"of a package and imports other submodules from that package."
msgstr ""
"Ceci importera :file:`example.py` comme un module autonome et exécutera :"
"func:`testmod` sur celui-ci. Notez que ceci peut ne pas fonctionner si le "
"fichier fait partie d'un paquet et importe d'autres sous-modules de ce "
"paquet."
#: library/doctest.rst:186
msgid ""
"For more information on :func:`testmod`, see section :ref:`doctest-basic-"
"api`."
msgstr ""
"Pour plus d'informations sur :func:`testmod`, consultez la section :ref:"
"`doctest-basic-api`."
#: library/doctest.rst:192
msgid "Simple Usage: Checking Examples in a Text File"
msgstr "Utilisation simple : vérifier des exemples dans un fichier texte"
#: library/doctest.rst:194
msgid ""
"Another simple application of doctest is testing interactive examples in a "
"text file. This can be done with the :func:`testfile` function::"
msgstr ""
"Une autre application simple de *doctest* est de tester des exemples "
"interactifs dans un fichier texte. Ceci est fait avec la fonction :func:"
"`testfile` ::"
#: library/doctest.rst:200
msgid ""
"That short script executes and verifies any interactive Python examples "
"contained in the file :file:`example.txt`. The file content is treated as "
"if it were a single giant docstring; the file doesn't need to contain a "
"Python program! For example, perhaps :file:`example.txt` contains this:"
msgstr ""
"Ce court script exécute et vérifie chacun des exemples Python interactifs "
"contenus dans le fichier :file:`example.txt`. Le contenu du fichier est "
"traité comme une seule *docstring* géante ; le fichier n'a pas besoin de "
"contenir un programme Python ! Par exemple, prenons un fichier :file:"
"`example.txt` contenant :"
#: library/doctest.rst:223
msgid ""
"Running ``doctest.testfile(\"example.txt\")`` then finds the error in this "
"documentation::"
msgstr ""
"Exécuter ``doctest.testfile(\"example.txt\")`` recherche les erreurs dans "
"cette documentation ::"
#: library/doctest.rst:234
msgid ""
"As with :func:`testmod`, :func:`testfile` won't display anything unless an "
"example fails. If an example does fail, then the failing example(s) and the "
"cause(s) of the failure(s) are printed to stdout, using the same format as :"
"func:`testmod`."
msgstr ""
"Comme pour :func:`testmod`, :func:`testfile` n'affichera rien sauf si un "
"exemple échoue. Si un exemple échoue, alors le ou les exemples défaillants "
"et leurs causes sont affichés sur *stdout*, dans le même format que :func:"
"`testmod`."
#: library/doctest.rst:239
msgid ""
"By default, :func:`testfile` looks for files in the calling module's "
"directory. See section :ref:`doctest-basic-api` for a description of the "
"optional arguments that can be used to tell it to look for files in other "
"locations."
msgstr ""
"Par défaut, :func:`testfile` cherche les fichiers dans le répertoire où se "
"situe le module qui l'appelle. Consultez la section :ref:`doctest-basic-api` "
"pour une description des options de ligne de commande à utiliser afin de "
"chercher dans d'autres répertoires."
#: library/doctest.rst:243
msgid ""
"Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-"
"v`` command-line switch or with the optional keyword argument *verbose*."
msgstr ""
"Comme pour :func:`testmod`, la verbosité de :func:`testfile` peut être "
"ajustée avec l'option de ligne de commande ``-v`` ou avec le mot clé "
"*verbose*."
#: library/doctest.rst:247
msgid ""
"There is also a command line shortcut for running :func:`testfile`. You can "
"instruct the Python interpreter to run the doctest module directly from the "
"standard library and pass the file name(s) on the command line::"
msgstr ""
"Il y a un raccourci pour exécuter :func:`testfile` à partir de la ligne de "
"commande. Demandez à l'interpréteur Python d'exécuter le module *doctest* "
"directement à partir de la bibliothèque standard et de passer le ou les noms "
"des modules à partir de la ligne de commande ainsi ::"
#: library/doctest.rst:253
msgid ""
"Because the file name does not end with :file:`.py`, :mod:`doctest` infers "
"that it must be run with :func:`testfile`, not :func:`testmod`."
msgstr ""
"Puisque le nom du fichier ne se termine pas par :file:`.py`, :mod:`doctest` "
"en déduit qu'il s'exécute à l'aide de :func:`testfile`, et non pas :func:"
"`testmod`."
#: library/doctest.rst:256
msgid ""
"For more information on :func:`testfile`, see section :ref:`doctest-basic-"
"api`."
msgstr ""
"Pour plus d'information sur :func:`testfile`, consultez la section :ref:"
"`doctest-basic-api`."
#: library/doctest.rst:262
msgid "How It Works"
msgstr "Comment ça marche"
#: library/doctest.rst:264
msgid ""
"This section examines in detail how doctest works: which docstrings it looks "
"at, how it finds interactive examples, what execution context it uses, how "
"it handles exceptions, and how option flags can be used to control its "
"behavior. This is the information that you need to know to write doctest "
"examples; for information about actually running doctest on these examples, "
"see the following sections."
msgstr ""
"Cette section examine en détail le fonctionnement de *doctest* : quelles "
"*docstrings* sont considérées, comment sont trouvés les exemples "
"interactifs, quel est le contexte d'exécution sélectionné, comment les "
"exceptions sont gérées, et de quelles façons les options de ligne de "
"commande peuvent être utilisées pour définir le comportement. Ceci est "
"l'information dont vous avez besoin pour écrire des exemples *doctest* ; "
"pour de l'information sur l'exécution de *doctest* sur ces exemples, "
"consultez les sections suivantes."
#: library/doctest.rst:275
msgid "Which Docstrings Are Examined?"
msgstr "Quelles *docstrings* sont considérées ?"
#: library/doctest.rst:277
msgid ""
"The module docstring, and all function, class and method docstrings are "
"searched. Objects imported into the module are not searched."
msgstr ""
"Les *docstrings* du module, de toutes les fonctions, classes, et méthodes "
"sont cherchées. Les objets qui sont importés dans le module ne sont pas "
"cherchés."
#: library/doctest.rst:280
msgid ""
"In addition, if ``M.__test__`` exists and \"is true\", it must be a dict, "
"and each entry maps a (string) name to a function object, class object, or "
"string. Function and class object docstrings found from ``M.__test__`` are "
"searched, and strings are treated as if they were docstrings. In output, a "
"key ``K`` in ``M.__test__`` appears with name ::"
msgstr ""
"De plus, si ``M.__test__`` existe et qu'il est vrai, il doit être un *dict* "
"dont chaque élément lie un nom (chaîne de caractère) à un objet (fonction, "
"classe, chaîne de caractère). Les *docstrings* d'objets fonctions et classes "
"trouvées dans ``M.__test__`` sont cherchés, et les chaînes de caractères "
"sont traitées comme si elles étaient des *docstrings*. En sortie, une clé "
"``K`` dans ``M.__test__`` apparaît avec le nom ::"
#: library/doctest.rst:288
msgid ""
"Any classes found are recursively searched similarly, to test docstrings in "
"their contained methods and nested classes."
msgstr ""
"Toute classe trouvée est ainsi cherchée récursivement, afin de tester les "
"*docstrings* contenues dans leurs méthodes et leurs classes imbriquées."
#: library/doctest.rst:295
msgid "How are Docstring Examples Recognized?"
msgstr "Comment les exemples *docstring* sont-ils identifiés ?"
#: library/doctest.rst:297
msgid ""
"In most cases a copy-and-paste of an interactive console session works fine, "
"but doctest isn't trying to do an exact emulation of any specific Python "
"shell."
msgstr ""
"Dans la plupart des cas, un copier-coller d'une séance interactive de "
"console fonctionne bien, mais *doctest* n'essaye pas de faire une simulation "
"exacte d'un *shell* Python spécifique."
#: library/doctest.rst:322
msgid ""
"Any expected output must immediately follow the final ``'>>> '`` or ``'... "
"'`` line containing the code, and the expected output (if any) extends to "
"the next ``'>>> '`` or all-whitespace line."
msgstr ""
"Toute sortie souhaitée doit immédiatement suivre le dernier ``'>>> '`` ou le "
"dernier ``'... '`` contenant le code, et la sortie souhaitée, s'il y en a "
"une, s'étend jusqu'au prochain ``'>>> '`` ou à la prochaine ligne vide."
#: library/doctest.rst:326
msgid "The fine print:"
msgstr "En détail :"
#: library/doctest.rst:328
msgid ""
"Expected output cannot contain an all-whitespace line, since such a line is "
"taken to signal the end of expected output. If expected output does contain "
"a blank line, put ``<BLANKLINE>`` in your doctest example each place a blank "
"line is expected."
msgstr ""
"La sortie souhaitée ne peut pas contenir une ligne vide, puisque contenir "
"une telle ligne signale la fin de la sortie souhaitée. Si la sortie "
"souhaitée doit contenir une ligne vide, ajoutez ``<BLANKLINE>`` dans votre "
"exemple *doctest* à chaque endroit où une ligne vide est souhaitée."
#: library/doctest.rst:333
msgid ""
"All hard tab characters are expanded to spaces, using 8-column tab stops. "
"Tabs in output generated by the tested code are not modified. Because any "
"hard tabs in the sample output *are* expanded, this means that if the code "
"output includes hard tabs, the only way the doctest can pass is if the :"
"const:`NORMALIZE_WHITESPACE` option or :ref:`directive <doctest-directives>` "
"is in effect. Alternatively, the test can be rewritten to capture the output "
"and compare it to an expected value as part of the test. This handling of "
"tabs in the source was arrived at through trial and error, and has proven to "
"be the least error prone way of handling them. It is possible to use a "
"different algorithm for handling tabs by writing a custom :class:"
"`DocTestParser` class."
msgstr ""
"Tous les caractères de tabulation insécables (*hard tab characters*) sont "
"convertis en espaces, en utilisant des taquets de tabulation de 8 espaces. "
"Les tabulations se trouvant dans la sortie générée par le code test ne sont "
"pas modifiées. Comme tout caractère de tabulation insécable *est* converti, "
"ceci veut dire que si le code de sortie inclut des caractères de tabulation "
"insécables, alors la seule façon que le *doctest* peut réussir est si "
"l'option :const:`NORMALIZE_WHITESPACE` ou si :ref:`directive <doctest-"
"directives>` a cours. De façon alternative, le test peut être ré-écrit afin "
"de capturer la sortie et de la comparer à un ensemble de valeurs attendues, "
"et ce, en tant qu'étape du test. Cette gestion des tabulations à la source a "
"été obtenue suite à un processus d'essais et d'erreurs ; il a été démontré "
"que c'était là la façon de les gérer qui soit la moins susceptible de "
"générer des erreurs. Il est possible d'utiliser un algorithme différent pour "
"la gestion des tabulations en rédigeant une classe sur mesure :class:"
"`DocTestParser`."
#: library/doctest.rst:345
msgid ""
"Output to stdout is captured, but not output to stderr (exception tracebacks "
"are captured via a different means)."
msgstr ""
"La sortie vers *stdout* est capturée, mais pas la sortie vers *stderr* (les "
"traces d'appel sont capturées par d'autres moyens)."
#: library/doctest.rst:348
msgid ""
"If you continue a line via backslashing in an interactive session, or for "
"any other reason use a backslash, you should use a raw docstring, which will "
"preserve your backslashes exactly as you type them::"
msgstr ""
"Si vous souhaitez conserver les barres obliques inversées telles quelles "
"lorsque vous terminez une ligne avec une barre oblique inversée dans une "
"séance interactive, ou quand vous utilisez une telle barre pour toute autre "
"raison, vous devez utiliser une *docstring* brute ::"
#: library/doctest.rst:357
msgid ""
"Otherwise, the backslash will be interpreted as part of the string. For "
"example, the ``\\n`` above would be interpreted as a newline character. "
"Alternatively, you can double each backslash in the doctest version (and not "
"use a raw string)::"
msgstr ""
"Sinon, la barre oblique inversée est interprétée comme faisant partie de la "
"chaîne de caractères. Par exemple, le ``\\n`` ci-dessus est interprété comme "
"un caractère de saut de ligne. De façon alternative, vous pouvez doubler "
"chaque barre oblique inversée dans la version *doctest* (et n'utilisez pas "
"dans ce cas de *docstring* brute) ::"
#: library/doctest.rst:366
msgid "The starting column doesn't matter::"
msgstr "La colonne de départ n'a pas d'importance ::"
#: library/doctest.rst:373
msgid ""
"and as many leading whitespace characters are stripped from the expected "
"output as appeared in the initial ``'>>> '`` line that started the example."
msgstr ""
"et autant d'espaces sont retirés de la sortie attendue qu'il y avait "
"d'espaces avant la ligne commençant par ``'>>> '``."
#: library/doctest.rst:380
msgid "What's the Execution Context?"
msgstr "Quel est le contexte d'exécution ?"
#: library/doctest.rst:382
msgid ""
"By default, each time :mod:`doctest` finds a docstring to test, it uses a "
"*shallow copy* of :mod:`M`'s globals, so that running tests doesn't change "
"the module's real globals, and so that one test in :mod:`M` can't leave "
"behind crumbs that accidentally allow another test to work. This means "
"examples can freely use any names defined at top-level in :mod:`M`, and "
"names defined earlier in the docstring being run. Examples cannot see names "
"defined in other docstrings."
msgstr ""
"Par défaut, chaque fois que :mod:`doctest` trouve une *docstring* à tester, "
"il utilise une *copie superficielle* des variables globales de :mod:`M`, de "
"telle façon que l'exécution de tests ne change pas les variables globales "
"réelles du module et que l'exécution d'un unique test dans :mod:`M` ne "
"puisse laisser traîner des miettes pouvant accidentellement causer la "
"réussite d'un autre test. Ceci signifie que les exemples peuvent utiliser "
"librement n'importe quel nom défini au niveau supérieur dans :mod:`M` ainsi "
"que les noms définis précédemment dans la *docstring* en cours d'exécution. "
"Les exemples ne peuvent voir les noms définis dans d'autres *docstrings*."
#: library/doctest.rst:390
msgid ""
"You can force use of your own dict as the execution context by passing "
"``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead."
msgstr ""
"Vous pouvez forcer l'utilisation de votre propre *dict* comme contexte "
"d'exécution en passant ``globs=your_dict`` à :func:`testmod` ou encore, à :"
"func:`testfile`."
#: library/doctest.rst:397
msgid "What About Exceptions?"
msgstr "Qu'en est-il des exceptions ?"
#: library/doctest.rst:399
msgid ""
"No problem, provided that the traceback is the only output produced by the "
"example: just paste in the traceback. [#]_ Since tracebacks contain details "
"that are likely to change rapidly (for example, exact file paths and line "
"numbers), this is one case where doctest works hard to be flexible in what "
"it accepts."
msgstr ""
"Pas de problèmes, tant que la trace d'appels est la seule sortie produite "
"par l'exemple : il suffit d'ajouter la trace. [#]_ Comme les traces d'appels "
"contiennent des détails qui sont sujets à changement rapide (par exemple, le "
"chemin exact vers un fichier et les numéros de ligne), ceci est un cas où "
"*doctest* fait un effort pour être flexible dans ce qu'il accepte."
#: library/doctest.rst:405
msgid "Simple example::"
msgstr "Exemple simple ::"
#: library/doctest.rst:412
msgid ""
"That doctest succeeds if :exc:`ValueError` is raised, with the ``list."
"remove(x): x not in list`` detail as shown."
msgstr ""
"Ce *doctest* réussit si :exc:`ValueError` est levée, avec le détail ``list."
"remote(x): x not in list`` tel que montré."
#: library/doctest.rst:415
msgid ""
"The expected output for an exception must start with a traceback header, "
"which may be either of the following two lines, indented the same as the "
"first line of the example::"
msgstr ""
"La sortie attendue pour une exception doit commencer par un en-tête de trace "
"d'appels, qui peut être l'une des deux lignes suivantes, avec la même "
"indentation que la première ligne de l'exemple ::"
#: library/doctest.rst:422
msgid ""
"The traceback header is followed by an optional traceback stack, whose "
"contents are ignored by doctest. The traceback stack is typically omitted, "
"or copied verbatim from an interactive session."
msgstr ""
"L'en-tête de la trace d'appels est suivi par une pile optionnelle de trace "
"d'appels, dont le contenu est ignoré par *doctest*. La trace d'appels est "
"habituellement omise, ou est copiée verbatim à partir d'une séance "
"interactive."
#: library/doctest.rst:426
msgid ""
"The traceback stack is followed by the most interesting part: the line(s) "
"containing the exception type and detail. This is usually the last line of "
"a traceback, but can extend across multiple lines if the exception has a "
"multi-line detail::"
msgstr ""
"La pile de trace d'appels est suivie par la partie la plus intéressante : la "
"ou les lignes contenant le type et le détail de l'exception. Ceci est "
"habituellement la dernière ligne de la trace d'appels ; dans le cas où "
"l'exception a un détail sur plusieurs lignes, il est possible de prolonger "
"sur plusieurs lignes ::"
#: library/doctest.rst:438
msgid ""
"The last three lines (starting with :exc:`ValueError`) are compared against "
"the exception's type and detail, and the rest are ignored."
msgstr ""
"Les trois dernières lignes (en commençant par :exc:`ValueError`) sont "
"comparées avec le type et le détail de l'exception ; tout le reste est "
"ignoré."
#: library/doctest.rst:441
msgid ""
"Best practice is to omit the traceback stack, unless it adds significant "
"documentation value to the example. So the last example is probably better "
"as::"
msgstr ""
"La pratique optimale est d'omettre la pile de trace d'appels, à moins que "
"celle-ci ait une valeur significative de documentation de l'exemple. Ainsi, "
"le dernier exemple est probablement meilleur tel qui suit ::"
#: library/doctest.rst:451
msgid ""
"Note that tracebacks are treated very specially. In particular, in the "
"rewritten example, the use of ``...`` is independent of doctest's :const:"
"`ELLIPSIS` option. The ellipsis in that example could be left out, or could "
"just as well be three (or three hundred) commas or digits, or an indented "
"transcript of a Monty Python skit."
msgstr ""
"Prenez note que les traces d'appels sont traitées de façon vraiment "
"particulière. Précisément, dans l'exemple ré-écrit, l'utilisation de ``...`` "
"est indépendante de l'option *doctest* :const:`ELLIPSIS`. Les points de "
"suspension dans cet exemple peuvent être omis, ou peuvent aussi être trois "
"(ou trois cents) virgules ou chiffres, ou une retranscription indentée d'une "
"parodie de Monty Python."
#: library/doctest.rst:457
msgid "Some details you should read once, but won't need to remember:"
msgstr ""
"Quelques détails que vous devriez lire une fois, mais que vous pouvez "
"oublier :"
#: library/doctest.rst:459
msgid ""
"Doctest can't guess whether your expected output came from an exception "
"traceback or from ordinary printing. So, e.g., an example that expects "
"``ValueError: 42 is prime`` will pass whether :exc:`ValueError` is actually "
"raised or if the example merely prints that traceback text. In practice, "
"ordinary output rarely begins with a traceback header line, so this doesn't "
"create real problems."
msgstr ""
"*Doctest* ne peut pas deviner si votre sortie attendue provient d'une trace "
"d'appels issue d'une exception ou d'un affichage ordinaire. Ainsi, si nous "
"avons un exemple s'attendant à obtenir ``ValueError: 42 is prime``, celui-ci "
"réussira peu importe si :exc:`ValueError` est réellement levée ou si "
"l'exemple affiche simplement ce texte de trace d'appels. Dans la pratique, "
"une sortie ordinaire commence rarement par une ligne d'en-tête de trace "
"d'appels ; ainsi, ceci ne pose pas de vrai problème."
#: library/doctest.rst:466
msgid ""
"Each line of the traceback stack (if present) must be indented further than "
"the first line of the example, *or* start with a non-alphanumeric character. "
"The first line following the traceback header indented the same and starting "
"with an alphanumeric is taken to be the start of the exception detail. Of "
"course this does the right thing for genuine tracebacks."
msgstr ""
"Chaque ligne de la trace d'appel (s'il y en a) doit soit être indentée d'un "
"niveau supplémentaire au niveau de la première ligne de l'exemple *ou* doit "
"commencer par un caractère qui ne soit pas alphanumérique. La première ligne "
"suivant l'en-tête de la trace d'appels qui soit indentée similairement et "
"qui commence par un caractère alphanumérique est comprise comme étant le "
"début du détail de l'exception. Bien sûr, ceci fait la chose adéquate pour "
"les traces d'appels véritables."
#: library/doctest.rst:472
msgid ""
"When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, "
"everything following the leftmost colon and any module information in the "
"exception name is ignored."
msgstr ""
"Lorsque l'option de *doctest* :const:`IGNORE_EXCEPTION_DETAIL` est définie, "
"tout ce qui suit le point-virgule se trouvant le plus à gauche ainsi que "
"toute information liée au module dans le nom de l'exception sont ignorés."
#: library/doctest.rst:476
msgid ""
"The interactive shell omits the traceback header line for some :exc:"
"`SyntaxError`\\ s. But doctest uses the traceback header line to "
"distinguish exceptions from non-exceptions. So in the rare case where you "
"need to test a :exc:`SyntaxError` that omits the traceback header, you will "
"need to manually add the traceback header line to your test example."
msgstr ""
"Le shell interactif omet la ligne d'en-tête de la trace d'appels pour "
"certaines erreurs :exc:`SyntaxError`. Ceci étant dit, *doctest* utilise la "
"ligne d'en-tête de la trace d'appels afin de faire une distinction entre les "
"exceptions et les autres types d'erreurs. Ainsi, dans les rares cas où vous "
"avez besoin de tester une erreur :exc:`SyntaxError` qui omet l'en-tête de la "
"trace d'appels, il vous est nécessaire d'ajouter manuellement la ligne d'en-"
"tête de la trace d'appels à l'exemple de test."
#: library/doctest.rst:484
#, fuzzy
msgid ""
"For some exceptions, Python displays the position of the error using ``^`` "
"markers and tildes::"
msgstr ""
"Pour certaines erreurs :exc:`SyntaxError`, Python affiche la position du "
"caractère de l'erreur de syntaxe, en utilisant un marqueur ``^`` ::"
#: library/doctest.rst:493
msgid ""
"Since the lines showing the position of the error come before the exception "
"type and detail, they are not checked by doctest. For example, the "
"following test would pass, even though it puts the ``^`` marker in the wrong "
"location::"
msgstr ""
"Comme les lignes dénotant la position de l'erreur précèdent le type et le "
"détail de l'exception, elles ne sont pas vérifiées par *doctest*. Par "
"exemple, le test suivant réussira, même si le marqueur ``^`` n'est pas à la "
"bonne place ::"
#: library/doctest.rst:508
msgid "Option Flags"
msgstr "Options de ligne de commande"
#: library/doctest.rst:510
msgid ""
"A number of option flags control various aspects of doctest's behavior. "
"Symbolic names for the flags are supplied as module constants, which can be :"
"ref:`bitwise ORed <bitwise>` together and passed to various functions. The "
"names can also be used in :ref:`doctest directives <doctest-directives>`, "
"and may be passed to the doctest command line interface via the ``-o`` "
"option."
msgstr ""
"Un ensemble d'options de ligne de commande contrôle différents aspects du "
"comportement de *doctest*. Pour les options, des noms symboliques sont "
"fournis comme des constantes de module, qui peuvent être composés par un OU "
"bit à bit (:ref:`bitwise ORed <bitwise>`) et passés à diverses fonctions. "
"Les noms peuvent aussi être utilisés dans des :ref:`instructions doctest "
"<doctest-directives>`, et peuvent être passés à l'interface de ligne de "
"commande de *doctest* à l'aide de l'option ``-o``."
#: library/doctest.rst:516
msgid "The ``-o`` command line option."
msgstr "L'option de ligne de commande ``-o``."
#: library/doctest.rst:519
msgid ""
"The first group of options define test semantics, controlling aspects of how "
"doctest decides whether actual output matches an example's expected output:"
msgstr ""
"Le premier groupe d'options définit les sémantiques de test, de façon à "
"contrôler comment *doctest* décide si la sortie obtenue correspond à la "
"sortie attendue de l'exemple :"
#: library/doctest.rst:525
msgid ""
"By default, if an expected output block contains just ``1``, an actual "
"output block containing just ``1`` or just ``True`` is considered to be a "
"match, and similarly for ``0`` versus ``False``. When :const:"
"`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is allowed. The "
"default behavior caters to that Python changed the return type of many "
"functions from integer to boolean; doctests expecting \"little integer\" "
"output still work in these cases. This option will probably go away, but "
"not for several years."
msgstr ""
"Par défaut, si un bloc de sortie attendu contient uniquement un ``1``, un "
"vrai bloc de sortie contenant uniquement un ``1`` ou un ``True`` sera "
"considéré comme étant une correspondance ; de façon similaire, nous avons "
"une correspondance pour ``0`` et ``False``. Lorsque l'option :const:"
"`DONT_ACCEPT_TRUE_FOR_1` est précisée, aucune de ces substitutions n'est "
"acceptée. Le comportement par défaut s'ajuste au fait que Python a changé le "
"type de renvoi de plusieurs fonctions, passant de nombres entiers à des "
"booléens ; les *doctests* s'attendant à une sortie de \"petit "
"entier\" (*little integer*) fonctionnent encore dans ces cas. Cette option "
"disparaîtra probablement, mais pas avant plusieurs années."
#: library/doctest.rst:537
msgid ""
"By default, if an expected output block contains a line containing only the "
"string ``<BLANKLINE>``, then that line will match a blank line in the actual "
"output. Because a genuinely blank line delimits the expected output, this "
"is the only way to communicate that a blank line is expected. When :const:"
"`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed."
msgstr ""
"Par défaut, si un bloc de sortie attendue contient une ligne contenant "
"uniquement la chaîne de caractères ``<BLANKLINE>``, alors cette ligne sera "
"en correspondance avec une ligne vide dans la sortie réelle. Puisqu'une "
"véritable ligne vide permet de délimiter la sortie attendue, ceci est la "
"seule façon de communiquer qu'une ligne vide est souhaitée. Lorsque "
"l'option :const:`DONT_ACCEPT_BLANKLINE` est précisée, cette substitution "
"n'est pas permise."
#: library/doctest.rst:546
msgid ""
"When specified, all sequences of whitespace (blanks and newlines) are "
"treated as equal. Any sequence of whitespace within the expected output "
"will match any sequence of whitespace within the actual output. By default, "
"whitespace must match exactly. :const:`NORMALIZE_WHITESPACE` is especially "
"useful when a line of expected output is very long, and you want to wrap it "
"across multiple lines in your source."
msgstr ""
"Lorsque précisé, toutes les séquences de caractères d'espacement et de "
"caractères de saut de ligne sont traitées comme équivalentes. Toute séquence "
"de caractères d'espacement à l'intérieur de la sortie attendue correspondra "
"alors à toute séquence de caractères d'espacement à l'intérieur de la sortie "
"réelle. Par défaut, les caractères d'espacement doivent correspondre de "
"façon exacte. L'option :const:`NORMALIZE_WHITESPACE` est particulièrement "
"utile lorsqu'une ligne de sortie attendue est très longue, et que l'on "
"souhaite la répartir sur plusieurs lignes dans le fichier source."
#: library/doctest.rst:557
msgid ""
"When specified, an ellipsis marker (``...``) in the expected output can "
"match any substring in the actual output. This includes substrings that "
"span line boundaries, and empty substrings, so it's best to keep usage of "
"this simple. Complicated uses can lead to the same kinds of \"oops, it "
"matched too much!\" surprises that ``.*`` is prone to in regular expressions."
msgstr ""
"Lorsque précisé, un marqueur de points de suspension (``...``) dans la "
"sortie attendue peut correspondre à n'importe quelle partie de chaîne de "
"caractères dans la sortie réelle. Ceci inclut les parties qui traversent les "
"frontières de lignes, ainsi que les parties vides de chaînes de caractères ; "
"ainsi, il est préférable d'en faire une utilisation simple. Les usages "
"complexes mènent aux mêmes surprises du type \"oups, il y avait trop de "
"correspondances !\" que l'utilisation de ``.*`` dans les expressions "
"régulières."
#: library/doctest.rst:566
msgid ""
"When specified, doctests expecting exceptions pass so long as an exception "
"of the expected type is raised, even if the details (message and fully "
"qualified exception name) don't match."
msgstr ""
#: library/doctest.rst:570
msgid ""
"For example, an example expecting ``ValueError: 42`` will pass if the actual "
"exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:"
"`TypeError` is raised instead. It will also ignore any fully qualified name "
"included before the exception class, which can vary between implementations "
"and versions of Python and the code/libraries in use. Hence, all three of "
"these variations will work with the flag specified:"
msgstr ""
#: library/doctest.rst:592
msgid ""
"Note that :const:`ELLIPSIS` can also be used to ignore the details of the "
"exception message, but such a test may still fail based on whether the "
"module name is present or matches exactly."
msgstr ""
#: library/doctest.rst:596
msgid ""
":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating "
"to the module containing the exception under test."
msgstr ""
"Maintenant, :const:`IGNORE_EXCEPTION_DETAIL` permet aussi d'ignorer toute "
"information liée au module contenant l'exception qui est en train d'être "
"testée."
#: library/doctest.rst:603
msgid ""
"When specified, do not run the example at all. This can be useful in "
"contexts where doctest examples serve as both documentation and test cases, "
"and an example should be included for documentation purposes, but should not "
"be checked. E.g., the example's output might be random; or the example "
"might depend on resources which would be unavailable to the test driver."
msgstr ""
"Lorsque précisé, cesse complètement l'exécution de tous les exemples. Ceci "
"peut être utile dans des contextes où les exemples *doctest* sont à la fois "
"de la documentation et des cas de tests, et qu'un exemple doit être inclus "
"pour des raisons de documentation, mais ne devrait pas être vérifié. Par "
"exemple, la sortie de l'exemple doit être aléatoire ; ou encore, lorsque "
"l'exemple peut dépendre de ressources inatteignables pour l'exécuteur de "
"test."
#: library/doctest.rst:609
msgid ""
"The SKIP flag can also be used for temporarily \"commenting out\" examples."
msgstr ""
"L'option *SKIP* peut aussi être utilisée temporairement afin de commenter "
"des exemples et d'en empêcher l'exécution."
#: library/doctest.rst:614
msgid "A bitmask or'ing together all the comparison flags above."
msgstr ""
"Un masque binaire effectuant une composition avec OU de toutes les options "
"de comparaisons ci-dessus."
#: library/doctest.rst:616
msgid "The second group of options controls how test failures are reported:"
msgstr ""
"Le deuxième groupe d'options détermine comment les échecs de tests sont "
"signalés :"
#: library/doctest.rst:621
msgid ""
"When specified, failures that involve multi-line expected and actual outputs "
"are displayed using a unified diff."
msgstr ""
"Lorsque précisé, les défaillances qui font intervenir des sorties attendues "
"et réelles multi-lignes sont affichées dans une *diff* unifiée."
#: library/doctest.rst:627
msgid ""
"When specified, failures that involve multi-line expected and actual outputs "
"will be displayed using a context diff."
msgstr ""
"Lorsque précisé, les défaillances qui font intervenir des sorties attendues "
"et réelles multi-lignes sont affichées dans une *diff* de contexte."
#: library/doctest.rst:633
msgid ""
"When specified, differences are computed by ``difflib.Differ``, using the "
"same algorithm as the popular :file:`ndiff.py` utility. This is the only "
"method that marks differences within lines as well as across lines. For "
"example, if a line of expected output contains digit ``1`` where actual "
"output contains letter ``l``, a line is inserted with a caret marking the "
"mismatching column positions."
msgstr ""
"Lorsque précisé, les différences sont obtenues grâce à ``difflib.Differ``, "
"en utilisant le même algorithme que le populaire utilitaire :file:`ndiff."
"py`. Ceci est la seule méthode qui puisse faire la différence à l'intérieur "
"des lignes ainsi que parmi les lignes prises conjointement. Par exemple, si "
"une ligne de sortie attendue contient le chiffre ``1`` alors que la sortie "
"réelle contient la lettre ``l``, une ligne est insérée avec un marqueur "
"caret démarquant les positions de colonnes où il n'y a pas de correspondance."
#: library/doctest.rst:642
msgid ""
"When specified, display the first failing example in each doctest, but "
"suppress output for all remaining examples. This will prevent doctest from "
"reporting correct examples that break because of earlier failures; but it "
"might also hide incorrect examples that fail independently of the first "
"failure. When :const:`REPORT_ONLY_FIRST_FAILURE` is specified, the "
"remaining examples are still run, and still count towards the total number "
"of failures reported; only the output is suppressed."
msgstr ""
"Lorsque précisé, le premier exemple défaillant de chaque *doctest* est "
"affiché, mais la sortie est supprimée pour tous les autres exemples. Ceci "
"empêche *doctest* de rapporter les exemples adéquats qui échouent du fait "
"d'échecs précédents ; ceci peut aussi cacher des exemples inadéquats qui "
"échouent de façon indépendante au premier échec. Lorsque :const:"
"`REPORT_ONLY_FIRST_FAILURE` est précisé, les exemples restants sont toujours "
"exécutés, et sont toujours comptabilisés dans le nombre total des lignes "
"échouant ; seulement la sortie est omise."
#: library/doctest.rst:653
msgid ""
"When specified, exit after the first failing example and don't attempt to "
"run the remaining examples. Thus, the number of failures reported will be at "
"most 1. This flag may be useful during debugging, since examples after the "
"first failure won't even produce debugging output."
msgstr ""
"Lorsque précisé, mettre fin à l'exécution après le premier exemple "
"défaillant et ne pas essayer d'exécuter les exemples restants. Ainsi, le "
"nombre d'échecs rapporté sera au plus un (1). Cette option peut être utile "
"durant le débogage, étant donné que les exemples suivant le premier échec ne "
"produiront aucune sortie de débogage."
#: library/doctest.rst:658
msgid ""
"The doctest command line accepts the option ``-f`` as a shorthand for ``-o "
"FAIL_FAST``."
msgstr ""
"La ligne de commande de *doctest* accepte l'option ``-f`` comme un raccourci "
"de ``-o FAIL_FAST``."
#: library/doctest.rst:666
msgid "A bitmask or'ing together all the reporting flags above."
msgstr ""
"Un masque binaire effectuant une composition avec le OU de toutes les "
"options de signalement ci-dessus."
#: library/doctest.rst:669
msgid ""
"There is also a way to register new option flag names, though this isn't "
"useful unless you intend to extend :mod:`doctest` internals via subclassing:"
msgstr ""
"Il y a aussi une façon d'enregistrer des nouveaux noms d'option, quoique "
"ceci n'est pas utile sauf dans le cas où vous devez faire une extension pour "
"le code interne de :mod:`doctest` par le biais d'une sous-classe :"
#: library/doctest.rst:675
msgid ""
"Create a new option flag with a given name, and return the new flag's "
"integer value. :func:`register_optionflag` can be used when subclassing :"
"class:`OutputChecker` or :class:`DocTestRunner` to create new options that "
"are supported by your subclasses. :func:`register_optionflag` should always "
"be called using the following idiom::"
msgstr ""
"Crée une nouvelle option avec un nom donné, et renvoie la valeur en nombre "
"entier de la nouvelle option. La fonction :func:`register_optionflag` peut "
"être utilisée lors de la création de sous-classes à partir de :class:"
"`OutputChecker` ou :class:`DocTestRunner` pour créer de nouvelles options "
"qui sont supportées par vos sous-classes. La fonction :func:"
"`register_optionflag` devrait toujours être appelée par l'expression "
"suivante ::"
#: library/doctest.rst:691
msgid "Directives"
msgstr "Instructions"
#: library/doctest.rst:693
msgid ""
"Doctest directives may be used to modify the :ref:`option flags <doctest-"
"options>` for an individual example. Doctest directives are special Python "
"comments following an example's source code:"
msgstr ""
"Les instructions *doctest* peuvent être utilisées afin de modifier les :ref:"
"`options <doctest-options>` pour un exemple individuel. Les instructions "
"*doctest* sont des commentaires Python spéciaux suivant le code source d'un "
"exemple :"
#: library/doctest.rst:704
#, fuzzy
msgid ""
"Whitespace is not allowed between the ``+`` or ``-`` and the directive "
"option name. The directive option name can be any of the option flag names "
"explained above."
msgstr ""
"Les caractères d'espacement ne sont pas permis entre les ``+`` ou les ``-`` "
"et le nom de l'option d'instruction. Le nom de l'option d'instruction peut "
"être n'importe lequel des noms d'options expliqués ci-dessus."
#: library/doctest.rst:708
msgid ""
"An example's doctest directives modify doctest's behavior for that single "
"example. Use ``+`` to enable the named behavior, or ``-`` to disable it."
msgstr ""
"Les instructions d'un exemple *doctest* modifient le comportement de "
"*doctest* et ce, seulement pour cet exemple. Utilisez ``+`` pour activer le "
"comportement nommé, ou ``-`` pour le désactiver."
#: library/doctest.rst:711
#, fuzzy
msgid "For example, this test passes:"
msgstr "Par exemple, ce test réussit :"
#: library/doctest.rst:720
#, fuzzy
msgid ""
"Without the directive it would fail, both because the actual output doesn't "
"have two blanks before the single-digit list elements, and because the "
"actual output is on a single line. This test also passes, and also requires "
"a directive to do so:"
msgstr ""
"Sans l'instruction, ce serait un échec, et ce, à la fois parce que la sortie "
"réelle n'a pas deux espaces vides avant les éléments de la liste formés d'un "
"seul chiffre, et aussi parce que la sortie réelle est contenue sur une seule "
"ligne. Ce test réussit aussi, et nécessite lui aussi une instruction pour ce "
"faire :"
#: library/doctest.rst:731
#, fuzzy
msgid ""
"Multiple directives can be used on a single physical line, separated by "
"commas:"
msgstr ""
"Plusieurs instructions sont utilisées sur une unique ligne physique, "
"séparées par des virgules :"
#: library/doctest.rst:740
#, fuzzy
msgid ""
"If multiple directive comments are used for a single example, then they are "
"combined:"
msgstr ""
"Si plusieurs commentaires d'instructions sont utilisés pour un exemple "
"unique, alors ils sont combinés :"
#: library/doctest.rst:750
#, fuzzy
msgid ""
"As the previous example shows, you can add ``...`` lines to your example "
"containing only directives. This can be useful when an example is too long "
"for a directive to comfortably fit on the same line:"
msgstr ""
"Comme l'exemple précédent le démontre, vous pouvez ajouter des lignes "
"contenant des points de suspension ``...`` à votre exemple ne contenant que "
"des instructions. Ceci peut être utile lorsqu'un exemple est trop long pour "
"qu'une instruction puisse être écrite sur la même ligne :"
#: library/doctest.rst:761
msgid ""
"Note that since all options are disabled by default, and directives apply "
"only to the example they appear in, enabling options (via ``+`` in a "
"directive) is usually the only meaningful choice. However, option flags can "
"also be passed to functions that run doctests, establishing different "
"defaults. In such cases, disabling an option via ``-`` in a directive can "
"be useful."
msgstr ""
"Prendre note que puisque toutes les options sont désactivées par défaut, et "
"comme les instructions s'appliquent uniquement aux exemples dans lesquelles "
"elles apparaissent, activer les options (par le biais de ``+`` dans une "
"instruction) est habituellement le seul choix ayant du sens. Toutefois, les "
"options peuvent aussi être passées aux fonctions qui exécutent les "
"*doctests*, définissant de nouvelles valeurs par défaut. Dans de tels cas, "
"désactiver une option par l'utilisation de ``-`` dans une instruction peut "
"être utile."
#: library/doctest.rst:771
msgid "Warnings"
msgstr "Avertissements"
#: library/doctest.rst:773
msgid ""
":mod:`doctest` is serious about requiring exact matches in expected output. "
"If even a single character doesn't match, the test fails. This will "
"probably surprise you a few times, as you learn exactly what Python does and "
"doesn't guarantee about output. For example, when printing a set, Python "
"doesn't guarantee that the element is printed in any particular order, so a "
"test like ::"
msgstr ""
"Le module :mod:`doctest` est rigoureux pour ce qui est d'inclure des "
"correspondances exactes dans la sortie attendue. Si un seul caractère ne "
"correspond pas, le test échoue. Ceci vous surprendra probablement quelques "
"fois, alors que vous apprenez exactement ce que Python garantit et ne "
"garantit pas pour qui est des sorties. Par exemple, lorsqu'on affiche un "
"ensemble (set), Python ne garantit pas que les éléments sont affichés dans "
"un ordre particulier ; ainsi un test tel que ::"
#: library/doctest.rst:782
msgid "is vulnerable! One workaround is to do ::"
msgstr "est vulnérable ! Une alternative est de faire ::"
#: library/doctest.rst:787
msgid "instead. Another is to do ::"
msgstr "à la place. Une autre façon de faire est ::"
#: library/doctest.rst:793
msgid "There are others, but you get the idea."
msgstr "Il y en a d'autres, mais vous saisissez l'idée."
#: library/doctest.rst:795
#, fuzzy
msgid "Another bad idea is to print things that embed an object address, like"
msgstr ""
"Une autre mauvaise idée est d'afficher des choses intégrant l'adresse d'un "
"objet, comme ceci ::"
#: library/doctest.rst:805
#, fuzzy
msgid ""
"The :const:`ELLIPSIS` directive gives a nice approach for the last example:"
msgstr ""
"L'instruction :const:`ELLIPSIS` donne une approche sympathique pour le "
"dernier exemple :"
#: library/doctest.rst:813
msgid ""
"Floating-point numbers are also subject to small output variations across "
"platforms, because Python defers to the platform C library for float "
"formatting, and C libraries vary widely in quality here. ::"
msgstr ""
"Les nombres à virgule flottante sont aussi sujets à de petites variations à "
"la sortie, tout dépendamment de la plateforme utilisée, étant donné que "
"Python s'en remet à la bibliothèque de la plateforme C pour la mise-en-forme "
"des *floats*, et les bibliothèques C varient grandement pour ce qui de leur "
"qualité sur ce point. ::"
#: library/doctest.rst:824
#, fuzzy
msgid ""
"Numbers of the form ``I/2.**J`` are safe across all platforms, and I often "
"contrive doctest examples to produce numbers of that form::"
msgstr ""
"Les nombres ayant la forme ``I/2.**J`` sont sécuritaires pour toutes les "
"plateformes, et je restreins souvent les exemples *doctest* à produire des "
"nombres ayant cette forme ::"
#: library/doctest.rst:830
msgid ""
"Simple fractions are also easier for people to understand, and that makes "
"for better documentation."
msgstr ""
"Les fractions simples sont aussi plus faciles à comprendre, et cela fait une "
"meilleure documentation."
#: library/doctest.rst:837
msgid "Basic API"
msgstr "API de base"
#: library/doctest.rst:839
msgid ""
"The functions :func:`testmod` and :func:`testfile` provide a simple "
"interface to doctest that should be sufficient for most basic uses. For a "
"less formal introduction to these two functions, see sections :ref:`doctest-"
"simple-testmod` and :ref:`doctest-simple-testfile`."
msgstr ""
"Les fonctions :func:`testmod` et :func:`testfile` fournissent une interface "
"simple pour *doctest* qui est suffisante pour les cas d'usage les plus "
"élémentaires. Pour une introduction moins formelle à ces deux fonctions, "
"voir les sections :ref:`doctest-simple-testmod` et :ref:`doctest-simple-"
"testfile`."
#: library/doctest.rst:847
msgid ""
"All arguments except *filename* are optional, and should be specified in "
"keyword form."
msgstr ""
"Tous les arguments sauf *filename* sont optionnels, et doivent être précisés "
"sous forme lettrée."
#: library/doctest.rst:850
msgid ""
"Test examples in the file named *filename*. Return ``(failure_count, "
"test_count)``."
msgstr ""
"Teste les exemples dans le fichier nommé *filename*. Renvoie "
"``(failure_count, test_count)``."
#: library/doctest.rst:853
msgid ""
"Optional argument *module_relative* specifies how the filename should be "
"interpreted:"
msgstr ""
"L'argument optionnel *module_relative* précise comment le nom de fichier "
"doit être interprété :"
#: library/doctest.rst:856
msgid ""
"If *module_relative* is ``True`` (the default), then *filename* specifies an "
"OS-independent module-relative path. By default, this path is relative to "
"the calling module's directory; but if the *package* argument is specified, "
"then it is relative to that package. To ensure OS-independence, *filename* "
"should use ``/`` characters to separate path segments, and may not be an "
"absolute path (i.e., it may not begin with ``/``)."
msgstr ""
"Si *module_relative* prend la valeur ``True`` (la valeur par défaut), alors "
"*filename* précise un chemin relatif au module qui soit indépendant du "
"système d'exploitation (*OS*). Par défaut, ce chemin est relatif au "
"répertoire du module appelant ; mais si l'argument *package* est précisé, "
"alors il est relatif à ce paquet. Pour garantir l'indépendance quant au "
"système d'exploitation, *filename* doit utiliser des caractères ``/`` pour "
"séparer chaque segment de chemin, et ne peut pas être un chemin absolu "
"(c'est-à-dire qu'il ne peut pas commencer par ``/``)."
#: library/doctest.rst:863
msgid ""
"If *module_relative* is ``False``, then *filename* specifies an OS-specific "
"path. The path may be absolute or relative; relative paths are resolved "
"with respect to the current working directory."
msgstr ""
"Si *module_relative* prend la valeur ``False``, alors *filename* précise un "
"chemin en fonction du système d'exploitation. Le chemin peut être absolu ou "
"relatif ; les chemins relatifs sont résolus en rapport au répertoire actif."
#: library/doctest.rst:867
msgid ""
"Optional argument *name* gives the name of the test; by default, or if "
"``None``, ``os.path.basename(filename)`` is used."
msgstr ""
"L'option *name* désigne le nom du test ; par défaut, ou si ``None`` est "
"passé en argument, ``os.path.basename(filename)`` est utilisé."
#: library/doctest.rst:870
msgid ""
"Optional argument *package* is a Python package or the name of a Python "
"package whose directory should be used as the base directory for a module-"
"relative filename. If no package is specified, then the calling module's "
"directory is used as the base directory for module-relative filenames. It "
"is an error to specify *package* if *module_relative* is ``False``."
msgstr ""
"L'option *package* est un paquet Python ou le nom d'un paquet Python dont le "
"répertoire doit être utilisé comme le répertoire principal pour un nom de "
"fichier lié à un module. Si aucun paquet n'est spécifié, le répertoire du "
"module appelé à l'exécution est utilisé comme le répertoire principal pour "
"les noms de fichiers liés au module. C'est une erreur que de spécifier "
"*package* si *module_relative* a ``False`` comme valeur."
#: library/doctest.rst:876
msgid ""
"Optional argument *globs* gives a dict to be used as the globals when "
"executing examples. A new shallow copy of this dict is created for the "
"doctest, so its examples start with a clean slate. By default, or if "
"``None``, a new empty dict is used."
msgstr ""
"L'option *globs* spécifie un *dict* à utiliser comme *globals* lorsque des "
"exemples sont exécutés. Une copie superficielle de ce *dict* est créée pour "
"le *doctest* ; ainsi, ces exemples commencent avec un état vide. Par défaut, "
"ou si ``None`` est passé en argument, un nouveau *dict* vide est utilisé."
#: library/doctest.rst:881
msgid ""
"Optional argument *extraglobs* gives a dict merged into the globals used to "
"execute examples. This works like :meth:`dict.update`: if *globs* and "
"*extraglobs* have a common key, the associated value in *extraglobs* appears "
"in the combined dict. By default, or if ``None``, no extra globals are "
"used. This is an advanced feature that allows parameterization of "
"doctests. For example, a doctest can be written for a base class, using a "
"generic name for the class, then reused to test any number of subclasses by "
"passing an *extraglobs* dict mapping the generic name to the subclass to be "
"tested."
msgstr ""
"L'option *extraglobs* spécifie un *dict* intégré dans les variables globales "
"utilisées pour exécuter l'exemple. Ceci fonctionne comme :meth:`dict."
"update` : si *globs* et *extraglobs* ont une clé commune, la valeur associée "
"à *extraglobs* apparaît dans le *dict* combiné. Par défaut, ou si ``None`` "
"est passé en argument, aucune variable globale supplémentaire est utilisée. "
"Ceci est une fonctionnalité avancée qui permet la configuration des "
"*doctests*. Par exemple, un *doctest* peut être rédigé pour une classe de "
"base, en utilisant un nom générique pour la classe, puis réutilisé afin de "
"tester un nombre indéfini de sous-classes en passant un *dict* *extraglobs* "
"reliant le nom générique à la sous-classe qui doit être testée."
#: library/doctest.rst:890
msgid ""
"Optional argument *verbose* prints lots of stuff if true, and prints only "
"failures if false; by default, or if ``None``, it's true if and only if ``'-"
"v'`` is in ``sys.argv``."
msgstr ""
"L'option *verbose* affiche une grande quantité d'information si elle est "
"vraie, et affiche uniquement les défaillances si elle est fausse ; par "
"défaut, ou si ``None``, celle-ci est vraie si et seulement si ``-v`` est "
"présent dans ``sys.argv``."
#: library/doctest.rst:894
msgid ""
"Optional argument *report* prints a summary at the end when true, else "
"prints nothing at the end. In verbose mode, the summary is detailed, else "
"the summary is very brief (in fact, empty if all tests passed)."
msgstr ""
"L'option *report* affiche un résumé à la fin lorsque vraie ; sinon, rien "
"n'est affiché à la fin. En mode *verbose*, le résumé est détaillé, sinon le "
"résumé est très bref (en fait, vide si tous les tests ont réussi)."
#: library/doctest.rst:898
msgid ""
"Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR "
"<bitwise>` of option flags. See section :ref:`doctest-options`."
msgstr ""
"L'option *optionflags* (dont la valeur par défaut est de zéro) calcule la "
"valeur :ref:`bitwise OR <bitwise>` des options de ligne de commande. Voir la "
"section :ref:`doctest-options`."
#: library/doctest.rst:902
msgid ""
"Optional argument *raise_on_error* defaults to false. If true, an exception "
"is raised upon the first failure or unexpected exception in an example. "
"This allows failures to be post-mortem debugged. Default behavior is to "
"continue running examples."
msgstr ""
"L'option *raise_on_error* est fausse par défaut. Si elle est vraie, une "
"exception est levée à la première défaillance ou à la première exception qui "
"ne soit prévue dans l'exemple. Ceci permet aux défaillances d'être analysées "
"lors d'un post-mortem. Le comportement par défaut est de poursuivre "
"l'exécution des exemples."
#: library/doctest.rst:1047
msgid ""
"Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) "
"that should be used to extract tests from the files. It defaults to a "
"normal parser (i.e., ``DocTestParser()``)."
msgstr ""
"L'option *parser* définit une classe ou une sous-classe :class:"
"`DocTestParser` qui doit être utilisée pour extraire les tests des fichiers. "
"Par défaut, on utilise un analyseur normal (c'est-à-dire, "
"``DocTestParser()``)."
#: library/doctest.rst:1051
msgid ""
"Optional argument *encoding* specifies an encoding that should be used to "
"convert the file to unicode."
msgstr ""
"L'option *encoding* définit un encodage à utiliser pour convertir le fichier "
"en format *unicode*."
#: library/doctest.rst:917
msgid ""
"All arguments are optional, and all except for *m* should be specified in "
"keyword form."
msgstr ""
"Toutes les options sont facultatives, et toutes sauf *m* doivent être "
"définies en format lettré."
#: library/doctest.rst:920
msgid ""
"Test examples in docstrings in functions and classes reachable from module "
"*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), "
"starting with ``m.__doc__``."
msgstr ""
"Ceci teste les exemples en *docstrings* dans les fonctions et les classes "
"accessibles depuis le module *m* (ou depuis le module :mod:`__main__` si *m* "
"n'a pas été défini ou est ``None``), en commençant par ``m.__doc__``."
#: library/doctest.rst:924
msgid ""
"Also test examples reachable from dict ``m.__test__``, if it exists and is "
"not ``None``. ``m.__test__`` maps names (strings) to functions, classes and "
"strings; function and class docstrings are searched for examples; strings "
"are searched directly, as if they were docstrings."
msgstr ""
"Ceci teste aussi les exemples accessibles depuis le *dict* ``m.__test__``, "
"si et seulement s'il existe et qu'il n'est pas ``None``. Le *dict* ``m."
"__test__`` associe des noms (chaînes de caractères) à des fonctions, des "
"classes et des chaînes de caractères ; les *docstrings* de fonctions et de "
"classes sont fouillées pour des exemples ; les chaînes de caractères sont "
"fouillées directement, comme si elles étaient des *docstrings*."
#: library/doctest.rst:929
msgid ""
"Only docstrings attached to objects belonging to module *m* are searched."
msgstr ""
"Seulement les *docstrings* attribuées à des objets appartenant au module *m* "
"sont fouillées."
#: library/doctest.rst:931
msgid "Return ``(failure_count, test_count)``."
msgstr "Renvoie ``(failure_count, test_count)``."
#: library/doctest.rst:933
msgid ""
"Optional argument *name* gives the name of the module; by default, or if "
"``None``, ``m.__name__`` is used."
msgstr ""
"L'option *name* donne le nom du module ; par défaut, ou si ``None``, ``m."
"__name__`` est utilisé."
#: library/doctest.rst:936
msgid ""
"Optional argument *exclude_empty* defaults to false. If true, objects for "
"which no doctests are found are excluded from consideration. The default is "
"a backward compatibility hack, so that code still using :meth:`doctest."
"master.summarize` in conjunction with :func:`testmod` continues to get "
"output for objects with no tests. The *exclude_empty* argument to the newer :"
"class:`DocTestFinder` constructor defaults to true."
msgstr ""
"L'option *exclude_empty* prend la valeur faux par défaut. Si la valeur est "
"vraie, les objets pour lesquels aucun *doctest* n'est trouvé ne sont pas "
"pris en compte. Le défaut est un bricolage permettant la compatibilité à "
"rebours, de façon à ce que le code qui utilise toujours :meth:`doctest."
"master.summarize` en conjonction avec :func:`testmod` puisse continuer "
"d'obtenir des sorties pour les objets n'ayant aucun test. L'option "
"*exclude_empty* dans le constructeur de la classe plus récente :class:"
"`DocTestFinder` prend vrai comme valeur par défaut."
#: library/doctest.rst:943
msgid ""
"Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, "
"*raise_on_error*, and *globs* are the same as for function :func:`testfile` "
"above, except that *globs* defaults to ``m.__dict__``."
msgstr ""
"Les options *extraglobs*, *verbose*, *report*, *optionflags*, "
"*raise_on_error*, et *globs* sont les mêmes que pour la fonction :func:"
"`testfile` ci-dessus, sauf pour *globs*, qui est ``m.__dict__`` par défaut."
#: library/doctest.rst:950
msgid ""
"Test examples associated with object *f*; for example, *f* may be a string, "
"a module, a function, or a class object."
msgstr ""
"Les exemples de test associés à l'objet *f* ; par exemple, *f* peut être une "
"chaîne de caractères, un module, une fonction, ou un objet de classe."
#: library/doctest.rst:953
msgid ""
"A shallow copy of dictionary argument *globs* is used for the execution "
"context."
msgstr ""
"Une copie superficielle de l'argument-dictionnaire *globs* est utilisée pour "
"le contexte d'exécution."
#: library/doctest.rst:955
msgid ""
"Optional argument *name* is used in failure messages, and defaults to "
"``\"NoName\"``."
msgstr ""
"L'option *name* est utilisée pour les messages d'échec, et prend "
"``\"NoName\"`` comme valeur par défaut."
#: library/doctest.rst:958
msgid ""
"If optional argument *verbose* is true, output is generated even if there "
"are no failures. By default, output is generated only in case of an example "
"failure."
msgstr ""
"Si l'option *verbose* est vraie, les sorties sont générées même s'il n'y a "
"aucun échec. Par défaut, la sortie est générée seulement si un exemple "
"échoue."
#: library/doctest.rst:961
msgid ""
"Optional argument *compileflags* gives the set of flags that should be used "
"by the Python compiler when running the examples. By default, or if "
"``None``, flags are deduced corresponding to the set of future features "
"found in *globs*."
msgstr ""
"L'option *compileflags* donne l'ensemble des options qui doit être utilisée "
"par le compilateur Python lorsqu'il exécute les exemples. Par défaut, ou si "
"``None``, les options sont inférées à partir de l'ensemble des "
"fonctionnalités futures trouvées dans *globs*."
#: library/doctest.rst:965
msgid ""
"Optional argument *optionflags* works as for function :func:`testfile` above."
msgstr ""
"L'option *optionflags* fonctionne similairement à la fonction :func:"
"`testfile` ci-dessus."
#: library/doctest.rst:971
msgid "Unittest API"
msgstr "API de tests unitaires"
#: library/doctest.rst:973
msgid ""
"As your collection of doctest'ed modules grows, you'll want a way to run all "
"their doctests systematically. :mod:`doctest` provides two functions that "
"can be used to create :mod:`unittest` test suites from modules and text "
"files containing doctests. To integrate with :mod:`unittest` test "
"discovery, include a :func:`load_tests` function in your test module::"
msgstr ""
"Au fur et à mesure que la collection de modules testés avec *doctest* "
"s'agrandira, vous allez souhaiter avoir une façon d'exécuter "
"systématiquement tous les *doctests*. Le module :mod:`doctest` fournit deux "
"fonctions qui peuvent être utilisées afin de créer des suites de tests "
"unitaires :mod:`unittest` à partir des modules et des fichiers textes "
"contenant des *doctests*. Afin d'intégrer la découverte fournie par :mod:"
"`unittest`, il suffit d'ajouter une fonction :func:`load_tests` dans votre "
"module de test ::"
#: library/doctest.rst:987
msgid ""
"There are two main functions for creating :class:`unittest.TestSuite` "
"instances from text files and modules with doctests:"
msgstr ""
"Il y a deux fonctions principales pour créer des instances de la classe :"
"class:`unittest.TestSuite` à partir de fichiers textes et de modules ayant "
"des *doctests* :"
#: library/doctest.rst:993
msgid ""
"Convert doctest tests from one or more text files to a :class:`unittest."
"TestSuite`."
msgstr ""
"Convertit des tests *doctest* à partir d'un ou plusieurs fichiers vers une "
"classe :class:`unittest.TestSuite`."
#: library/doctest.rst:996
msgid ""
"The returned :class:`unittest.TestSuite` is to be run by the unittest "
"framework and runs the interactive examples in each file. If an example in "
"any file fails, then the synthesized unit test fails, and a :exc:"
"`failureException` exception is raised showing the name of the file "
"containing the test and a (sometimes approximate) line number."
msgstr ""
"La classe renvoyée :class:`unittest.TestSuite` doit être exécutée dans le "
"cadriciel de tests unitaires et exécute les exemples interactifs trouvés "
"dans chaque fichier. Si un exemple de n'importe quel fichier échoue, alors "
"le test unitaire de synthèse échoue aussi, et une exception :exc:"
"`failureException` est levée, affichant le nom du fichier contenant le test "
"et un numéro de ligne (celui-ci est parfois approximatif)."
#: library/doctest.rst:1002
msgid "Pass one or more paths (as strings) to text files to be examined."
msgstr ""
"Passe un ou plusieurs chemins (sous forme de chaînes de caractères) à des "
"fichiers textes afin d'être vérifiés."
#: library/doctest.rst:1004
msgid "Options may be provided as keyword arguments:"
msgstr "Les options peuvent être fournies comme des options lettrées :"
#: library/doctest.rst:1006
msgid ""
"Optional argument *module_relative* specifies how the filenames in *paths* "
"should be interpreted:"
msgstr ""
"L'option *module_relative* précise comment les noms de fichiers dans *paths* "
"doivent être interprétés :"
#: library/doctest.rst:1009
msgid ""
"If *module_relative* is ``True`` (the default), then each filename in "
"*paths* specifies an OS-independent module-relative path. By default, this "
"path is relative to the calling module's directory; but if the *package* "
"argument is specified, then it is relative to that package. To ensure OS-"
"independence, each filename should use ``/`` characters to separate path "
"segments, and may not be an absolute path (i.e., it may not begin with ``/"
"``)."
msgstr ""
"Si *module_relative* a ``True`` comme valeur (valeur par défaut), alors "
"chaque nom de fichier dans *paths* précise un chemin relatif au module qui "
"soit indépendant du système d'exploitation. Par défaut, ce chemin est "
"relatif au répertoire du module appelant ; mais si l'option *package* est "
"précisée, alors il est relatif à ce paquet. Afin de garantir l'indépendance "
"face au système d'exploitation, chaque nom de fichier doit utiliser des "
"caractères ``/`` afin de séparer les segments de chemin, et ne peut pas être "
"un chemin absolu (c'est-à-dire, il ne peut pas commencer par ``/``)."
#: library/doctest.rst:1017
msgid ""
"If *module_relative* is ``False``, then each filename in *paths* specifies "
"an OS-specific path. The path may be absolute or relative; relative paths "
"are resolved with respect to the current working directory."
msgstr ""
"Si *module_relative* prend la valeur ``False``, alors *filename* précise un "
"chemin en fonction du système d'exploitation. Le chemin peut être absolu ou "
"relatif ; les chemins relatifs sont résolus en rapport au répertoire actif."
#: library/doctest.rst:1021
msgid ""
"Optional argument *package* is a Python package or the name of a Python "
"package whose directory should be used as the base directory for module-"
"relative filenames in *paths*. If no package is specified, then the calling "
"module's directory is used as the base directory for module-relative "
"filenames. It is an error to specify *package* if *module_relative* is "
"``False``."
msgstr ""
"L'option *package* est un paquet Python ou le nom d'un paquet Python dont le "
"répertoire dont être utilisé comme le répertoire principal pour un nom de "
"fichier dans *paths* qui soit lié à un module. Si aucun paquet n'est "
"spécifié, le répertoire du module appelé à l'exécution est utilisé comme le "
"répertoire principal pour les noms de fichiers liés au module. C'est une "
"erreur que de spécifier *package* si *module_relative* a ``False`` comme "
"valeur."
#: library/doctest.rst:1028
msgid ""
"Optional argument *setUp* specifies a set-up function for the test suite. "
"This is called before running the tests in each file. The *setUp* function "
"will be passed a :class:`DocTest` object. The setUp function can access the "
"test globals as the *globs* attribute of the test passed."
msgstr ""
"L'option *setUp* précise une fonction de mise-en-place pour la suite de "
"tests. Ceci est appelé avant l'exécution des tests dans chaque fichier. La "
"fonction *setUp* est passée à un objet :class:`DocTest`. La fonction *setUp* "
"peut accéder aux valeurs globales du test par le biais de l'attribut *globs* "
"du test passé."
#: library/doctest.rst:1033
msgid ""
"Optional argument *tearDown* specifies a tear-down function for the test "
"suite. This is called after running the tests in each file. The *tearDown* "
"function will be passed a :class:`DocTest` object. The setUp function can "
"access the test globals as the *globs* attribute of the test passed."
msgstr ""
"L'option *tearDown* précise une fonction de démolition pour la suite de "
"tests. Celle-ci est appelée après avoir exécuté les tests dans chaque "
"fichier. La fonction *tearDown* est passée à un objet :class:`DocTest`. La "
"fonction *setUp* peut accéder aux valeurs globales du test par l'attribut "
"*globs* du test passé."
#: library/doctest.rst:1072
msgid ""
"Optional argument *globs* is a dictionary containing the initial global "
"variables for the tests. A new copy of this dictionary is created for each "
"test. By default, *globs* is a new empty dictionary."
msgstr ""
"L'option *globs* est un dictionnaire contenant les variables globales "
"initiales pour les tests. Une nouvelle copie de ce dictionnaire est créée "
"pour chaque test. Par défaut, *globs* est un nouveau dictionnaire vide."
#: library/doctest.rst:1042
msgid ""
"Optional argument *optionflags* specifies the default doctest options for "
"the tests, created by or-ing together individual option flags. See section :"
"ref:`doctest-options`. See function :func:`set_unittest_reportflags` below "
"for a better way to set reporting options."
msgstr ""
"Les options *optionflags* précisent les options par défaut de *doctest* pour "
"les tests, créées en composant par un OU les différentes options "
"individuelles. Voir la section :ref:`doctest-options`. Voir la fonction :"
"func:`set_unittest_reportflags` ci-dessous pour une meilleure façon de "
"préciser des options de rapport."
#: library/doctest.rst:1054
msgid ""
"The global ``__file__`` is added to the globals provided to doctests loaded "
"from a text file using :func:`DocFileSuite`."
msgstr ""
"La valeur globale ``__file__`` est ajoutée aux valeurs globales fournies par "
"les *doctests*, ceux-ci étant téléchargés d'un fichier texte utilisant la "
"fonction :func:`DocFileSuite`."
#: library/doctest.rst:1060
msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`."
msgstr ""
"Convertit les tests *doctest* pour un module donné à une classe :class:"
"`unittest.TestSuite`."
#: library/doctest.rst:1062
msgid ""
"The returned :class:`unittest.TestSuite` is to be run by the unittest "
"framework and runs each doctest in the module. If any of the doctests fail, "
"then the synthesized unit test fails, and a :exc:`failureException` "
"exception is raised showing the name of the file containing the test and a "
"(sometimes approximate) line number."
msgstr ""
"La classe renvoyée :class:`unittest.TestSuite` doit être exécutée par le "
"cadriciel de test unitaire, afin d'exécuter chaque *doctest* dans le module. "
"Si n'importe lequel des *doctests* échoue, alors le test unitaire de "
"synthèse échoue, et une exception :exc:`failureException` est levée, "
"affichant le nom du fichier contenant le test et un numéro de ligne pouvant "
"être approximatif."
#: library/doctest.rst:1068
msgid ""
"Optional argument *module* provides the module to be tested. It can be a "
"module object or a (possibly dotted) module name. If not specified, the "
"module calling this function is used."
msgstr ""
"L'option *module* fournit le module qui sera testé. Il peut prendre la forme "
"d'un objet-module ou celle du nom d'un module (possiblement *dotted*). Si "
"non-précisée, le module appelant cette fonction est utilisé."
#: library/doctest.rst:1076
msgid ""
"Optional argument *extraglobs* specifies an extra set of global variables, "
"which is merged into *globs*. By default, no extra globals are used."
msgstr ""
"L'option *extraglobs* précise un ensemble supplémentaire de variables "
"globales, à fusionner avec *globs*. Par défaut, aucune variable globale "
"supplémentaire est utilisée."
#: library/doctest.rst:1079
msgid ""
"Optional argument *test_finder* is the :class:`DocTestFinder` object (or a "
"drop-in replacement) that is used to extract doctests from the module."
msgstr ""
"L'option *test_finder* est l'instance de :class:`DocTestFinder` (ou un "
"remplacement *drop-in*) qui est utilisée pour extraire les *doctests* à "
"partir du module."
#: library/doctest.rst:1082
msgid ""
"Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as "
"for function :func:`DocFileSuite` above."
msgstr ""
"Les options *setUp*, *tearDown* et *optionflags* sont les mêmes que pour la "
"fonction :func:`DocFileSuite` ci-dessus."
#: library/doctest.rst:1085
msgid "This function uses the same search technique as :func:`testmod`."
msgstr ""
"Cette fonction utilise la même technique de recherche que :func:`testmod`."
#: library/doctest.rst:1087
msgid ""
":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if "
"*module* contains no docstrings instead of raising :exc:`ValueError`."
msgstr ""
"La fonction :func:`DocTestSuite` renvoie une instance vide de la classe :"
"class:`unittest.TestSuite` si *module* ne contient aucune *docstring*, et "
"ce, au lieu de lever l'exception :exc:`ValueError`."
#: library/doctest.rst:1092
msgid ""
"Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` "
"out of :class:`doctest.DocTestCase` instances, and :class:`DocTestCase` is a "
"subclass of :class:`unittest.TestCase`. :class:`DocTestCase` isn't "
"documented here (it's an internal detail), but studying its code can answer "
"questions about the exact details of :mod:`unittest` integration."
msgstr ""
"Sous le capot, :func:`DocTestSuite` crée une classe :class:`unittest."
"TestSuite` à partir d'instances de :class:`doctest.DocTestCase` ; de plus, :"
"class:`DocTestCase` est une sous-classe de :class:`unittest.TestCase`. La "
"classe :class:`DocTestCase` n'est pas documentée ici (c'est un détail "
"interne), mais l'étude de son code peut répondre à des questions concernant "
"les détails exacts de l'intégration du module :mod:`doctest`."
#: library/doctest.rst:1098
msgid ""
"Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out "
"of :class:`doctest.DocFileCase` instances, and :class:`DocFileCase` is a "
"subclass of :class:`DocTestCase`."
msgstr ""
"De la même façon, :func:`DocFileSuite` crée une classe :class:`unittest."
"TestSuite` à partir des instances :class:`doctest.DocFileCase`, où :class:"
"`DocFileCase` est une sous-classe de :class:`DocTestCase`."
#: library/doctest.rst:1102
msgid ""
"So both ways of creating a :class:`unittest.TestSuite` run instances of :"
"class:`DocTestCase`. This is important for a subtle reason: when you run :"
"mod:`doctest` functions yourself, you can control the :mod:`doctest` options "
"in use directly, by passing option flags to :mod:`doctest` functions. "
"However, if you're writing a :mod:`unittest` framework, :mod:`unittest` "
"ultimately controls when and how tests get run. The framework author "
"typically wants to control :mod:`doctest` reporting options (perhaps, e.g., "
"specified by command line options), but there's no way to pass options "
"through :mod:`unittest` to :mod:`doctest` test runners."
msgstr ""
"Ainsi, les deux façons de créer une :class:`unittest.TestSuite` utilisent "
"des instances de la classe :class:`DocTestCase`. Ceci est important pour une "
"raison subtile : lorsque vous exécutez par vous-même des fonctions :mod:"
"`doctest`, vous pouvez contrôler les options :mod:`doctest` qui sont "
"utilisées de façon directe, en passant des options aux fonctions :mod:"
"`doctest`. Toutefois, si vous écrivez un cadriciel :mod:`unittest`, alors :"
"mod:`unittest` a le contrôle final de quand et de comment les tests sont "
"exécutés. La personne qui écrit le cadriciel souhaite habituellement "
"contrôler les options de rapport de :mod:`doctest` (qui sont peut-être, par "
"exemple, spécifiées en options de ligne de commande), sauf qu'il n'y a pas "
"de moyen de spécifier des options à l'attention des exécuteurs de test de :"
"mod:`doctest` à partir de :mod:`unittest`."
#: library/doctest.rst:1112
msgid ""
"For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` "
"reporting flags specific to :mod:`unittest` support, via this function:"
msgstr ""
"Pour cette raison, :mod:`doctest` implémente le concept d'options de rapport "
"de :mod:`doctest` qui soit spécifique à :mod:`unittest`, par le biais de "
"cette fonction :"
#: library/doctest.rst:1118
msgid "Set the :mod:`doctest` reporting flags to use."
msgstr ""
"Voir les options de ligne de commandes de :mod:`doctest` pour l'utilisation."
#: library/doctest.rst:1120
msgid ""
"Argument *flags* takes the :ref:`bitwise OR <bitwise>` of option flags. See "
"section :ref:`doctest-options`. Only \"reporting flags\" can be used."
msgstr ""
"L'argument *flags* prend la :ref:`composition OU bit à bit <bitwise>` des "
"arguments. Voir la section :ref:`doctest-options`. Ce sont uniquement les "
"\"options de rapport\" qui peuvent être utilisées."
#: library/doctest.rst:1123
msgid ""
"This is a module-global setting, and affects all future doctests run by "
"module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` "
"looks at the option flags specified for the test case when the :class:"
"`DocTestCase` instance was constructed. If no reporting flags were "
"specified (which is the typical and expected case), :mod:`doctest`'s :mod:"
"`unittest` reporting flags are :ref:`bitwise ORed <bitwise>` into the option "
"flags, and the option flags so augmented are passed to the :class:"
"`DocTestRunner` instance created to run the doctest. If any reporting flags "
"were specified when the :class:`DocTestCase` instance was constructed, :mod:"
"`doctest`'s :mod:`unittest` reporting flags are ignored."
msgstr ""
"Ceci est un paramètre au niveau global du module, et affecte tous les futurs "
"*doctests* exécutés par le module :mod:`unittest` : la méthode :meth:"
"`runTest` de :class:`DocTestCase` prend en compte les options précisées pour "
"le cas de test lorsque l'instance de la classe :class:`DocTestCase` a été "
"construite. Si aucune option de rapport n'a été précisée (ce qui est le cas "
"typique et attendu), les options de rapport du module :mod:`unitest` de :mod:"
"`doctest` sont :ref:`<composés avec un OU <bitwise>` vers les options, et "
"les options obtenues sont passées à l'instance de la classe :class:"
"`DocTestRunner` créée pour exécuter le *doctest*. Si une seule option de "
"rapport a été précisée lorsque l'instance de :class:`DocTestCase` a été "
"construite, les options de rapport du module :mod:`unittest` de :mod:"
"`doctest` sont ignorées."
#: library/doctest.rst:1134
msgid ""
"The value of the :mod:`unittest` reporting flags in effect before the "
"function was called is returned by the function."
msgstr ""
"La valeur prise par les options de rapport de :mod:`unittest` et ce, avant "
"que la fonction n'ait été appelée, est renvoyée par la fonction."
#: library/doctest.rst:1141
msgid "Advanced API"
msgstr "API avancé"
#: library/doctest.rst:1143
msgid ""
"The basic API is a simple wrapper that's intended to make doctest easy to "
"use. It is fairly flexible, and should meet most users' needs; however, if "
"you require more fine-grained control over testing, or wish to extend "
"doctest's capabilities, then you should use the advanced API."
msgstr ""
#: library/doctest.rst:1148
msgid ""
"The advanced API revolves around two container classes, which are used to "
"store the interactive examples extracted from doctest cases:"
msgstr ""
#: library/doctest.rst:1151
msgid ""
":class:`Example`: A single Python :term:`statement`, paired with its "
"expected output."
msgstr ""
":class:`Example` : Un unique :term:`statement` Python, pris conjointement "
"avec sa sortie attendue."
#: library/doctest.rst:1154
msgid ""
":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted "
"from a single docstring or text file."
msgstr ""
":class:`DocTest` : Une collection de :class:`Example`, habituellement "
"extraits d'une seule *docstring* ou fichier texte."
#: library/doctest.rst:1157
msgid ""
"Additional processing classes are defined to find, parse, and run, and check "
"doctest examples:"
msgstr ""
#: library/doctest.rst:1160
msgid ""
":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :"
"class:`DocTestParser` to create a :class:`DocTest` from every docstring that "
"contains interactive examples."
msgstr ""
#: library/doctest.rst:1164
msgid ""
":class:`DocTestParser`: Creates a :class:`DocTest` object from a string "
"(such as an object's docstring)."
msgstr ""
#: library/doctest.rst:1167
msgid ""
":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and "
"uses an :class:`OutputChecker` to verify their output."
msgstr ""
#: library/doctest.rst:1170
msgid ""
":class:`OutputChecker`: Compares the actual output from a doctest example "
"with the expected output, and decides whether they match."
msgstr ""
#: library/doctest.rst:1173
msgid ""
"The relationships among these processing classes are summarized in the "
"following diagram::"
msgstr ""
#: library/doctest.rst:1189
msgid "DocTest Objects"
msgstr "Objets *doctest*"
#: library/doctest.rst:1194
msgid ""
"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."
msgstr ""
#: library/doctest.rst:1198
msgid ""
":class:`DocTest` defines the following attributes. They are initialized by "
"the constructor, and should not be modified directly."
msgstr ""
":class:`DocTest` définit les attributs suivants. Ils sont initialisés par le "
"constructeur, et ne doivent pas être modifiés directement."
#: library/doctest.rst:1204
msgid ""
"A list of :class:`Example` objects encoding the individual interactive "
"Python examples that should be run by this test."
msgstr ""
#: library/doctest.rst:1210
msgid ""
"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 :attr:"
"`globs` after the test is run."
msgstr ""
#: library/doctest.rst:1218
msgid ""
"A string name identifying the :class:`DocTest`. Typically, this is the name "
"of the object or file that the test was extracted from."
msgstr ""
#: library/doctest.rst:1224
msgid ""
"The name of the file that this :class:`DocTest` was extracted from; or "
"``None`` if the filename is unknown, or if the :class:`DocTest` was not "
"extracted from a file."
msgstr ""
#: library/doctest.rst:1231
msgid ""
"The line number within :attr:`filename` where this :class:`DocTest` begins, "
"or ``None`` if the line number is unavailable. This line number is zero-"
"based with respect to the beginning of the file."
msgstr ""
#: library/doctest.rst:1238
msgid ""
"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."
msgstr ""
#: library/doctest.rst:1245
msgid "Example Objects"
msgstr "Exemples d'objets"
#: library/doctest.rst:1250
msgid ""
"A single interactive example, consisting of a Python statement and its "
"expected output. The constructor arguments are used to initialize the "
"attributes of the same names."
msgstr ""
#: library/doctest.rst:1255
msgid ""
":class:`Example` defines the following attributes. They are initialized by "
"the constructor, and should not be modified directly."
msgstr ""
#: library/doctest.rst:1261
msgid ""
"A string containing the example's source code. This source code consists of "
"a single Python statement, and always ends with a newline; the constructor "
"adds a newline when necessary."
msgstr ""
#: library/doctest.rst:1268
msgid ""
"The expected output from running the example's source code (either from "
"stdout, or a traceback in case of exception). :attr:`want` ends with a "
"newline unless no output is expected, in which case it's an empty string. "
"The constructor adds a newline when necessary."
msgstr ""
#: library/doctest.rst:1276
msgid ""
"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 :"
"func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a newline "
"unless it's ``None``. The constructor adds a newline if needed."
msgstr ""
#: library/doctest.rst:1285
msgid ""
"The line number within the string containing this example where the example "
"begins. This line number is zero-based with respect to the beginning of the "
"containing string."
msgstr ""
#: library/doctest.rst:1292
msgid ""
"The example's indentation in the containing string, i.e., the number of "
"space characters that precede the example's first prompt."
msgstr ""
#: library/doctest.rst:1298
msgid ""
"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 :class:`DocTestRunner`'s :attr:`optionflags`). By default, no options "
"are set."
msgstr ""
#: library/doctest.rst:1307
msgid "DocTestFinder objects"
msgstr "Objets *DocTestFinder*"
#: library/doctest.rst:1312
msgid ""
"A processing class used to extract the :class:`DocTest`\\ s that are "
"relevant to a given object, from its docstring and the docstrings of its "
"contained objects. :class:`DocTest`\\ s can be extracted from modules, "
"classes, functions, methods, staticmethods, classmethods, and properties."
msgstr ""
#: library/doctest.rst:1317
msgid ""
"The optional argument *verbose* can be used to display the objects searched "
"by the finder. It defaults to ``False`` (no output)."
msgstr ""
#: library/doctest.rst:1320
msgid ""
"The optional argument *parser* specifies the :class:`DocTestParser` object "
"(or a drop-in replacement) that is used to extract doctests from docstrings."
msgstr ""
#: library/doctest.rst:1323
msgid ""
"If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` "
"will only examine the given object, and not any contained objects."
msgstr ""
#: library/doctest.rst:1326
msgid ""
"If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder."
"find` will include tests for objects with empty docstrings."
msgstr ""
#: library/doctest.rst:1330
msgid ":class:`DocTestFinder` defines the following method:"
msgstr "La classe :class:`DocTestFinder` définit la méthode suivante :"
#: library/doctest.rst:1335
msgid ""
"Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s "
"docstring, or by any of its contained objects' docstrings."
msgstr ""
#: library/doctest.rst:1338
msgid ""
"The optional argument *name* specifies the object's name; this name will be "
"used to construct names for the returned :class:`DocTest`\\ s. If *name* is "
"not specified, then ``obj.__name__`` is used."
msgstr ""
#: library/doctest.rst:1342
msgid ""
"The optional parameter *module* is the module that contains the given "
"object. If the module is not specified or is ``None``, then the test finder "
"will attempt to automatically determine the correct module. The object's "
"module is used:"
msgstr ""
#: library/doctest.rst:1346
msgid "As a default namespace, if *globs* is not specified."
msgstr ""
#: library/doctest.rst:1348
msgid ""
"To prevent the DocTestFinder from extracting DocTests from objects that are "
"imported from other modules. (Contained objects with modules other than "
"*module* are ignored.)"
msgstr ""
#: library/doctest.rst:1352
msgid "To find the name of the file containing the object."
msgstr "Afin de trouver le nom du fichier contenant l'objet."
#: library/doctest.rst:1354
msgid "To help find the line number of the object within its file."
msgstr ""
#: library/doctest.rst:1356
msgid ""
"If *module* is ``False``, no attempt to find the module will be made. This "
"is obscure, of use mostly in testing doctest itself: if *module* is "
"``False``, or is ``None`` but cannot be found automatically, then all "
"objects are considered to belong to the (non-existent) module, so all "
"contained objects will (recursively) be searched for doctests."
msgstr ""
#: library/doctest.rst:1362
msgid ""
"The globals for each :class:`DocTest` is formed by combining *globs* and "
"*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new "
"shallow copy of the globals dictionary is created for each :class:`DocTest`. "
"If *globs* is not specified, then it defaults to the module's *__dict__*, if "
"specified, or ``{}`` otherwise. If *extraglobs* is not specified, then it "
"defaults to ``{}``."
msgstr ""
#: library/doctest.rst:1373
msgid "DocTestParser objects"
msgstr "Objets *DocTestParser*"
#: library/doctest.rst:1378
msgid ""
"A processing class used to extract interactive examples from a string, and "
"use them to create a :class:`DocTest` object."
msgstr ""
#: library/doctest.rst:1450
msgid ":class:`DocTestParser` defines the following methods:"
msgstr "La classe :class:`DocTestFinder` définit les méthodes suivantes :"
#: library/doctest.rst:1387
msgid ""
"Extract all doctest examples from the given string, and collect them into a :"
"class:`DocTest` object."
msgstr ""
"Extrait tous les exemples de *doctests* à partir de la chaîne de caractère "
"donnée, et les réunit dans un objet :class:`DocTest`."
#: library/doctest.rst:1390
msgid ""
"*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:"
"`DocTest` object. See the documentation for :class:`DocTest` for more "
"information."
msgstr ""
"Notez que *globs*, *name*, *filname* et *lineno* sont des attributs pour le "
"nouvel objet :class:`DocTest`. Voir la documentation pour :class:`DocTest` "
"pour plus d'information."
#: library/doctest.rst:1397
msgid ""
"Extract all doctest examples from the given string, and return them as a "
"list of :class:`Example` objects. Line numbers are 0-based. The optional "
"argument *name* is a name identifying this string, and is only used for "
"error messages."
msgstr ""
#: library/doctest.rst:1404
msgid ""
"Divide the given string into examples and intervening text, and return them "
"as a list of alternating :class:`Example`\\ s and strings. Line numbers for "
"the :class:`Example`\\ s are 0-based. The optional argument *name* is a "
"name identifying this string, and is only used for error messages."
msgstr ""
#: library/doctest.rst:1413
msgid "DocTestRunner objects"
msgstr "Objets *DocTestRunner*"
#: library/doctest.rst:1418
msgid ""
"A processing class used to execute and verify the interactive examples in a :"
"class:`DocTest`."
msgstr ""
#: library/doctest.rst:1421
msgid ""
"The comparison between expected outputs and actual outputs is done by an :"
"class:`OutputChecker`. This comparison may be customized with a number of "
"option flags; see section :ref:`doctest-options` for more information. If "
"the option flags are insufficient, then the comparison may also be "
"customized by passing a subclass of :class:`OutputChecker` to the "
"constructor."
msgstr ""
#: library/doctest.rst:1427
msgid ""
"The test runner's display output can be controlled in two ways. First, an "
"output function can be passed to :meth:`TestRunner.run`; this function will "
"be called with strings that should be displayed. It defaults to ``sys."
"stdout.write``. If capturing the output is not sufficient, then the display "
"output can be also customized by subclassing DocTestRunner, and overriding "
"the methods :meth:`report_start`, :meth:`report_success`, :meth:"
"`report_unexpected_exception`, and :meth:`report_failure`."
msgstr ""
#: library/doctest.rst:1435
msgid ""
"The optional keyword argument *checker* specifies the :class:`OutputChecker` "
"object (or drop-in replacement) that should be used to compare the expected "
"outputs to the actual outputs of doctest examples."
msgstr ""
#: library/doctest.rst:1439
msgid ""
"The optional keyword argument *verbose* controls the :class:"
"`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is "
"printed about each example, as it is run. If *verbose* is ``False``, then "
"only failures are printed. If *verbose* is unspecified, or ``None``, then "
"verbose output is used iff the command-line switch ``-v`` is used."
msgstr ""
#: library/doctest.rst:1445
msgid ""
"The optional keyword argument *optionflags* can be used to control how the "
"test runner compares expected output to actual output, and how it displays "
"failures. For more information, see section :ref:`doctest-options`."
msgstr ""
#: library/doctest.rst:1455
msgid ""
"Report that the test runner is about to process the given example. This "
"method is provided to allow subclasses of :class:`DocTestRunner` to "
"customize their output; it should not be called directly."
msgstr ""
#: library/doctest.rst:1459
msgid ""
"*example* is the example about to be processed. *test* is the test "
"*containing example*. *out* is the output function that was passed to :meth:"
"`DocTestRunner.run`."
msgstr ""
#: library/doctest.rst:1466
msgid ""
"Report that the given example ran successfully. This method is provided to "
"allow subclasses of :class:`DocTestRunner` to customize their output; it "
"should not be called directly."
msgstr ""
#: library/doctest.rst:1481
msgid ""
"*example* is the example about to be processed. *got* is the actual output "
"from the example. *test* is the test containing *example*. *out* is the "
"output function that was passed to :meth:`DocTestRunner.run`."
msgstr ""
#: library/doctest.rst:1477
msgid ""
"Report that the given example failed. This method is provided to allow "
"subclasses of :class:`DocTestRunner` to customize their output; it should "
"not be called directly."
msgstr ""
#: library/doctest.rst:1488
msgid ""
"Report that the given example raised an unexpected exception. This method is "
"provided to allow subclasses of :class:`DocTestRunner` to customize their "
"output; it should not be called directly."
msgstr ""
#: library/doctest.rst:1492
msgid ""
"*example* is the example about to be processed. *exc_info* is a tuple "
"containing information about the unexpected exception (as returned by :func:"
"`sys.exc_info`). *test* is the test containing *example*. *out* is the "
"output function that was passed to :meth:`DocTestRunner.run`."
msgstr ""
#: library/doctest.rst:1500
msgid ""
"Run the examples in *test* (a :class:`DocTest` object), and display the "
"results using the writer function *out*."
msgstr ""
#: library/doctest.rst:1503
msgid ""
"The examples are run in the namespace ``test.globs``. If *clear_globs* is "
"true (the default), then this namespace will be cleared after the test runs, "
"to help with garbage collection. If you would like to examine the namespace "
"after the test completes, then use *clear_globs=False*."
msgstr ""
#: library/doctest.rst:1508
msgid ""
"*compileflags* gives the set of flags that should be used by the Python "
"compiler when running the examples. If not specified, then it will default "
"to the set of future-import flags that apply to *globs*."
msgstr ""
#: library/doctest.rst:1512
msgid ""
"The output of each example is checked using the :class:`DocTestRunner`'s "
"output checker, and the results are formatted by the :meth:`DocTestRunner."
"report_\\*` methods."
msgstr ""
#: library/doctest.rst:1519
msgid ""
"Print a summary of all the test cases that have been run by this "
"DocTestRunner, and return a :term:`named tuple` ``TestResults(failed, "
"attempted)``."
msgstr ""
#: library/doctest.rst:1522
msgid ""
"The optional *verbose* argument controls how detailed the summary is. If "
"the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity "
"is used."
msgstr ""
#: library/doctest.rst:1529
msgid "OutputChecker objects"
msgstr "Objets *OutputChecker*"
#: library/doctest.rst:1534
msgid ""
"A class used to check the whether the actual output from a doctest example "
"matches the expected output. :class:`OutputChecker` defines two methods: :"
"meth:`check_output`, which compares a given pair of outputs, and returns "
"``True`` if they match; and :meth:`output_difference`, which returns a "
"string describing the differences between two outputs."
msgstr ""
#: library/doctest.rst:1541
msgid ":class:`OutputChecker` defines the following methods:"
msgstr "La classe :class:`OutputChecker` définit les méthodes suivantes :"
#: library/doctest.rst:1545
msgid ""
"Return ``True`` iff the actual output from an example (*got*) matches the "
"expected output (*want*). These strings are always considered to match if "
"they are identical; but depending on what option flags the test runner is "
"using, several non-exact match types are also possible. See section :ref:"
"`doctest-options` for more information about option flags."
msgstr ""
#: library/doctest.rst:1554
msgid ""
"Return a string describing the differences between the expected output for a "
"given example (*example*) and the actual output (*got*). *optionflags* is "
"the set of option flags used to compare *want* and *got*."
msgstr ""
#: library/doctest.rst:1562
msgid "Debugging"
msgstr "Débogage"
#: library/doctest.rst:1564
msgid "Doctest provides several mechanisms for debugging doctest examples:"
msgstr ""
"*Doctest* fournit plusieurs mécanismes pour déboguer des exemples *doctest* :"
#: library/doctest.rst:1566
msgid ""
"Several functions convert doctests to executable Python programs, which can "
"be run under the Python debugger, :mod:`pdb`."
msgstr ""
"Plusieurs fonctions convertissent les *doctests* en programmes Python "
"exécutables, qui peuvent être exécutés grâce au débogueur Python, :mod:`pdb`."
#: library/doctest.rst:1569
msgid ""
"The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that "
"raises an exception for the first failing example, containing information "
"about that example. This information can be used to perform post-mortem "
"debugging on the example."
msgstr ""
#: library/doctest.rst:1574
msgid ""
"The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :"
"meth:`debug` method defined by :class:`unittest.TestCase`."
msgstr ""
#: library/doctest.rst:1577
msgid ""
"You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll "
"drop into the Python debugger when that line is executed. Then you can "
"inspect current values of variables, and so on. For example, suppose :file:"
"`a.py` contains just this module docstring::"
msgstr ""
#: library/doctest.rst:1592
msgid "Then an interactive Python session may look like this::"
msgstr "Alors une séance interactive de Python peut ressembler à ceci ::"
#: library/doctest.rst:1625
msgid ""
"Functions that convert doctests to Python code, and possibly run the "
"synthesized code under the debugger:"
msgstr ""
#: library/doctest.rst:1631
msgid "Convert text with examples to a script."
msgstr "Convertit du texte contenant des exemples en un script."
#: library/doctest.rst:1633
msgid ""
"Argument *s* is a string containing doctest examples. The string is "
"converted to a Python script, where doctest examples in *s* are converted to "
"regular code, and everything else is converted to Python comments. The "
"generated script is returned as a string. For example, ::"
msgstr ""
#: library/doctest.rst:1648
#, fuzzy
msgid "displays::"
msgstr "affiche ::"
#: library/doctest.rst:1658
msgid ""
"This function is used internally by other functions (see below), but can "
"also be useful when you want to transform an interactive Python session into "
"a Python script."
msgstr ""
"Cette fonction est utilisée à l'interne par d'autres fonctions (voir ci-"
"bas), mais peut aussi être utile lorsque l'on souhaite transformer une "
"séance interactive de Python en script Python."
#: library/doctest.rst:1665
msgid "Convert the doctest for an object to a script."
msgstr "Convertit en script l'objet *doctest*."
#: library/doctest.rst:1667
msgid ""
"Argument *module* is a module object, or dotted name of a module, containing "
"the object whose doctests are of interest. Argument *name* is the name "
"(within the module) of the object with the doctests of interest. The result "
"is a string, containing the object's docstring converted to a Python script, "
"as described for :func:`script_from_examples` above. For example, if "
"module :file:`a.py` contains a top-level function :func:`f`, then ::"
msgstr ""
#: library/doctest.rst:1677
msgid ""
"prints a script version of function :func:`f`'s docstring, with doctests "
"converted to code, and the rest placed in comments."
msgstr ""
"affiche une version script de la *docstring* de la fonction :func:`f`, avec "
"des *doctests* convertis en code, et le reste dans les commentaires."
#: library/doctest.rst:1683
msgid "Debug the doctests for an object."
msgstr "Débogue les *doctests* pour un objet."
#: library/doctest.rst:1685
msgid ""
"The *module* and *name* arguments are the same as for function :func:"
"`testsource` above. The synthesized Python script for the named object's "
"docstring is written to a temporary file, and then that file is run under "
"the control of the Python debugger, :mod:`pdb`."
msgstr ""
#: library/doctest.rst:1690
msgid ""
"A shallow copy of ``module.__dict__`` is used for both local and global "
"execution context."
msgstr ""
"Une copie superficielle de ``module.__dict__`` est utilisée à la fois pour "
"les contextes d'exécution locaux et globaux."
#: library/doctest.rst:1693
msgid ""
"Optional argument *pm* controls whether post-mortem debugging is used. If "
"*pm* has a true value, the script file is run directly, and the debugger "
"gets involved only if the script terminates via raising an unhandled "
"exception. If it does, then post-mortem debugging is invoked, via :func:"
"`pdb.post_mortem`, passing the traceback object from the unhandled "
"exception. If *pm* is not specified, or is false, the script is run under "
"the debugger from the start, via passing an appropriate :func:`exec` call "
"to :func:`pdb.run`."
msgstr ""
#: library/doctest.rst:1704
msgid "Debug the doctests in a string."
msgstr "Débogue les *doctests* dans une chaîne de caractères."
#: library/doctest.rst:1706
msgid ""
"This is like function :func:`debug` above, except that a string containing "
"doctest examples is specified directly, via the *src* argument."
msgstr ""
"Ceci est similaire à la fonction :func:`debug` décrite ci-haut, mis-à-part "
"qu'une chaîne de caractères contenant des exemples *doctest* est définie "
"directement, par l'option *src*."
#: library/doctest.rst:1709
msgid ""
"Optional argument *pm* has the same meaning as in function :func:`debug` "
"above."
msgstr ""
"L'option *pm* a la même définition que dans la fonction :func:`debug` ci-"
"haut."
#: library/doctest.rst:1711
msgid ""
"Optional argument *globs* gives a dictionary to use as both local and global "
"execution context. If not specified, or ``None``, an empty dictionary is "
"used. If specified, a shallow copy of the dictionary is used."
msgstr ""
"L'option *globs* définit un dictionnaire à utiliser comme contexte "
"d'exécution global et local. Si elle n'est pas définie, ou si ``None``, un "
"dictionnaire vide est utilisé. Si définie, une copie superficielle du "
"dictionnaire est utilisée."
#: library/doctest.rst:1716
msgid ""
"The :class:`DebugRunner` class, and the special exceptions it may raise, are "
"of most interest to testing framework authors, and will only be sketched "
"here. See the source code, and especially :class:`DebugRunner`'s docstring "
"(which is a doctest!) for more details:"
msgstr ""
#: library/doctest.rst:1724
msgid ""
"A subclass of :class:`DocTestRunner` that raises an exception as soon as a "
"failure is encountered. If an unexpected exception occurs, an :exc:"
"`UnexpectedException` exception is raised, containing the test, the example, "
"and the original exception. If the output doesn't match, then a :exc:"
"`DocTestFailure` exception is raised, containing the test, the example, and "
"the actual output."
msgstr ""
#: library/doctest.rst:1731
msgid ""
"For information about the constructor parameters and methods, see the "
"documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-"
"api`."
msgstr ""
"Pour de l'information sur les paramètres et méthodes du constructeur, voir "
"la documentation pour la classe :class:`DocTestrunner` dans la section :reF:"
"`doctest-advanced-api`."
#: library/doctest.rst:1734
msgid ""
"There are two exceptions that may be raised by :class:`DebugRunner` "
"instances:"
msgstr ""
"Il y a deux exceptions qui peuvent être levées par des instances :class:"
"`DebugRunner` :"
#: library/doctest.rst:1739
msgid ""
"An exception raised by :class:`DocTestRunner` to signal that a doctest "
"example's actual output did not match its expected output. The constructor "
"arguments are used to initialize the attributes of the same names."
msgstr ""
"Une exception levée par :class:`DocTestRunner` pour signaler que la sortie "
"obtenue suite à un exemple *doctest* ne correspond pas à la sortie attendue. "
"Les arguments du constructeur sont utilisés pour initialiser les attributs "
"des mêmes noms."
#: library/doctest.rst:1743
msgid ":exc:`DocTestFailure` defines the following attributes:"
msgstr ":exc:`DocTestFailure` définit les attributs suivants :"
#: library/doctest.rst:1772
msgid "The :class:`DocTest` object that was being run when the example failed."
msgstr ""
"L'objet issu de la classe :class:`DocTest` qui était en cours d'exécution "
"lorsque l'exemple a échoué."
#: library/doctest.rst:1777
msgid "The :class:`Example` that failed."
msgstr "L'exemple :class:`Example` qui a échoué."
#: library/doctest.rst:1758
msgid "The example's actual output."
msgstr "La sortie obtenue par l'exécution de l'exemple."
#: library/doctest.rst:1763
msgid ""
"An exception raised by :class:`DocTestRunner` to signal that a doctest "
"example raised an unexpected exception. The constructor arguments are used "
"to initialize the attributes of the same names."
msgstr ""
"Une exception levée par :class:`DocTestRunner` afin de signaler qu'un "
"exemple *doctest* a levé une exception inattendue. Les arguments du "
"constructeur sont utilisés pour initialiser les attributs des mêmes noms."
#: library/doctest.rst:1767
msgid ":exc:`UnexpectedException` defines the following attributes:"
msgstr ":exc:`UnexpectedException` définit les attributs suivants :"
#: library/doctest.rst:1782
msgid ""
"A tuple containing information about the unexpected exception, as returned "
"by :func:`sys.exc_info`."
msgstr ""
"Un n-uplet contenant l'information au sujet de l'exception inattendue, telle "
"que retourné par :func:`sys.exc_info`."
#: library/doctest.rst:1789
msgid "Soapbox"
msgstr "Éditorial"
#: library/doctest.rst:1791
msgid ""
"As mentioned in the introduction, :mod:`doctest` has grown to have three "
"primary uses:"
msgstr ""
"Comme mentionné dans l'introduction, :mod:`doctest` a présentement trois "
"usages principaux :"
#: library/doctest.rst:1794
msgid "Checking examples in docstrings."
msgstr "Vérifier les exemples dans les *docstrings*."
#: library/doctest.rst:1796
msgid "Regression testing."
msgstr "Test de régression."
#: library/doctest.rst:1798
msgid "Executable documentation / literate testing."
msgstr "De la documentation exécutable / des tests littéraires."
#: library/doctest.rst:1800
msgid ""
"These uses have different requirements, and it is important to distinguish "
"them. In particular, filling your docstrings with obscure test cases makes "
"for bad documentation."
msgstr ""
#: library/doctest.rst:1804
msgid ""
"When writing a docstring, choose docstring examples with care. There's an "
"art to this that needs to be learned---it may not be natural at first. "
"Examples should add genuine value to the documentation. A good example can "
"often be worth many words. If done with care, the examples will be "
"invaluable for your users, and will pay back the time it takes to collect "
"them many times over as the years go by and things change. I'm still amazed "
"at how often one of my :mod:`doctest` examples stops working after a "
"\"harmless\" change."
msgstr ""
#: library/doctest.rst:1812
msgid ""
"Doctest also makes an excellent tool for regression testing, especially if "
"you don't skimp on explanatory text. By interleaving prose and examples, it "
"becomes much easier to keep track of what's actually being tested, and why. "
"When a test fails, good prose can make it much easier to figure out what the "
"problem is, and how it should be fixed. It's true that you could write "
"extensive comments in code-based testing, but few programmers do. Many have "
"found that using doctest approaches instead leads to much clearer tests. "
"Perhaps this is simply because doctest makes writing prose a little easier "
"than writing code, while writing comments in code is a little harder. I "
"think it goes deeper than just that: the natural attitude when writing a "
"doctest-based test is that you want to explain the fine points of your "
"software, and illustrate them with examples. This in turn naturally leads to "
"test files that start with the simplest features, and logically progress to "
"complications and edge cases. A coherent narrative is the result, instead "
"of a collection of isolated functions that test isolated bits of "
"functionality seemingly at random. It's a different attitude, and produces "
"different results, blurring the distinction between testing and explaining."
msgstr ""
#: library/doctest.rst:1830
msgid ""
"Regression testing is best confined to dedicated objects or files. There "
"are several options for organizing tests:"
msgstr ""
#: library/doctest.rst:1833
msgid ""
"Write text files containing test cases as interactive examples, and test the "
"files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, "
"although is easiest to do for new projects, designed from the start to use "
"doctest."
msgstr ""
#: library/doctest.rst:1838
msgid ""
"Define functions named ``_regrtest_topic`` that consist of single "
"docstrings, containing test cases for the named topics. These functions can "
"be included in the same file as the module, or separated out into a separate "
"test file."
msgstr ""
#: library/doctest.rst:1842
msgid ""
"Define a ``__test__`` dictionary mapping from regression test topics to "
"docstrings containing test cases."
msgstr ""
#: library/doctest.rst:1845
msgid ""
"When you have placed your tests in a module, the module can itself be the "
"test runner. When a test fails, you can arrange for your test runner to re-"
"run only the failing doctest while you debug the problem. Here is a minimal "
"example of such a test runner::"
msgstr ""
"Lorsque vous placez vos tests dans un module, le module lui-même peut être "
"l'exécuteur de tests. Lorsqu'un test échoue, vous pouvez signifier à votre "
"exécuteur de tests de rouler une seconde fois uniquement les tests qui "
"échouent et ce, tant que vous travaillez sur le problème. Voici un exemple "
"minimal d'un test exécuteur de tests ::"
#: library/doctest.rst:1867
msgid "Footnotes"
msgstr "Notes"
#: library/doctest.rst:1868
msgid ""
"Examples containing both expected output and an exception are not supported. "
"Trying to guess where one ends and the other begins is too error-prone, and "
"that also makes for a confusing test."
msgstr ""
"Les exemples contenant à la fois la sortie attendue et une exception ne sont "
"pas supportés. Tenter de deviner où finit l'un et où commence l'autre peut "
"mener à plusieurs erreurs, en plus d'être un test qui soit source de "
"confusion."
#~ msgid ""
#~ "When specified, an example that expects an exception passes if an "
#~ "exception of the expected type is raised, even if the exception detail "
#~ "does not match. For example, an example expecting ``ValueError: 42`` "
#~ "will pass if the actual exception raised is ``ValueError: 3*14``, but "
#~ "will fail, e.g., if :exc:`TypeError` is raised."
#~ msgstr ""
#~ "Lorsque précisé, un exemple qui s'attend à une exception réussit le test "
#~ "si une exception du type attendu est levée, même si le détail de "
#~ "l'exception ne correspond pas. Par exemple, un exemple s'attendant à "
#~ "``ValueError: 42`` réussira si l'exception réellement levée est "
#~ "``ValueError: 3*14``, mais échouera si par exemple :exc:`TypeError` est "
#~ "levée."
#~ msgid ""
#~ "It will also ignore the module name used in Python 3 doctest reports. "
#~ "Hence both of these variations will work with the flag specified, "
#~ "regardless of whether the test is run under Python 2.7 or Python 3.2 (or "
#~ "later versions)::"
#~ msgstr ""
#~ "Il fera fi du nom de module utilisé dans les rapports *doctest* de Python "
#~ "3. Ainsi, ces deux variations fonctionneront avec l'option précisée, peu "
#~ "importe si le test est exécuté avec Python 2.7 ou Python 3.2 (ou des "
#~ "versions ultérieures) ::"
#~ msgid ""
#~ "Note that :const:`ELLIPSIS` can also be used to ignore the details of the "
#~ "exception message, but such a test may still fail based on whether or not "
#~ "the module details are printed as part of the exception name. Using :"
#~ "const:`IGNORE_EXCEPTION_DETAIL` and the details from Python 2.3 is also "
#~ "the only clear way to write a doctest that doesn't care about the "
#~ "exception detail yet continues to pass under Python 2.3 or earlier (those "
#~ "releases do not support :ref:`doctest directives <doctest-directives>` "
#~ "and ignore them as irrelevant comments). For example::"
#~ msgstr ""
#~ "Prendre note que :const:`ELLIPSIS` peut aussi être utilisée afin "
#~ "d'ignorer les détails du message d'exception, mais un tel test peut tout "
#~ "de même échouer si les détails du module sont affichés comme faisant "
#~ "partie du nom de l'exception. L'utilisation de :const:"
#~ "`IGNORE_EXCEPTION_DETAIL` et des détails de Python 2.3 est aussi la seule "
#~ "façon claire d'écrire un *doctest* qui ne se soucie pas du détail "
#~ "d'exception tout en continuant de réussir, et ce, pour Python 2.3 ou "
#~ "antérieur (ces versions ne supportent pas les :ref:`instructions doctest "
#~ "<doctest-directives>`, les ignorant et les traitant comme des "
#~ "commentaires sans pertinence). Par exemple ::"
#~ msgid ""
#~ "passes under Python 2.3 and later Python versions with the flag "
#~ "specified, even though the detail changed in Python 2.4 to say \"does "
#~ "not\" instead of \"doesn't\"."
#~ msgstr ""
#~ "réussit sous Python 2.3 ainsi que pour les versions ultérieures de "
#~ "Python, avec l'option précisée, même si le détail a été changé dans "
#~ "Python 2.4 pour mentionner *\"does not\"* plutôt que *\"doesn't\"* (ne "
#~ "fait pas)."
#~ msgid ""
#~ "Before Python 3.6, when printing a dict, Python did not guarantee that "
#~ "the key-value pairs was printed in any particular order."
#~ msgstr ""
#~ "Avant Python 3.6, lorsque Python affichait un *dict*, il ne garantissait "
#~ "pas que les paires clés-valeurs suivaient un ordre particulier."