Working on library/unittest.mock.po (#658)

This commit is contained in:
Pierre Bousquié 2019-05-12 12:13:47 +02:00 committed by Julien Palard
parent ce05327148
commit 96a7e2a794

View File

@ -5,22 +5,23 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Python 3.6\n" "Project-Id-Version: Python 3.6\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-04-22 12:07+0200\n"
"POT-Creation-Date: 2019-04-10 09:35+0200\n" "POT-Creation-Date: 2019-04-10 09:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n" "Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.1\n"
"Last-Translator: Bousquié Pierre <pierre.bousquie@gmail.com>\n"
#: ../Doc/library/unittest.mock.rst:3 #: ../Doc/library/unittest.mock.rst:3
msgid ":mod:`unittest.mock` --- mock object library" msgid ":mod:`unittest.mock` --- mock object library"
msgstr "" msgstr ":mod:`unittest.mock` — Bibliothèque d'objets simulacres"
#: ../Doc/library/unittest.mock.rst:13 #: ../Doc/library/unittest.mock.rst:13
msgid "**Source code:** :source:`Lib/unittest/mock.py`" msgid "**Source code:** :source:`Lib/unittest/mock.py`"
msgstr "" msgstr "**Code source :** :source:`Lib/unittest/mock.py`"
#: ../Doc/library/unittest.mock.rst:17 #: ../Doc/library/unittest.mock.rst:17
msgid "" msgid ""
@ -28,6 +29,9 @@ msgid ""
"replace parts of your system under test with mock objects and make " "replace parts of your system under test with mock objects and make "
"assertions about how they have been used." "assertions about how they have been used."
msgstr "" msgstr ""
":mod:`unittest.mock` est une bibliothèque pour tester en Python. Elle permet "
"de remplacer des parties du système sous tests par des objets simulacres et "
"faire des assertions sur la façon dont ces objets ont été utilisés."
#: ../Doc/library/unittest.mock.rst:21 #: ../Doc/library/unittest.mock.rst:21
msgid "" msgid ""
@ -37,6 +41,12 @@ msgid ""
"and arguments they were called with. You can also specify return values and " "and arguments they were called with. You can also specify return values and "
"set needed attributes in the normal way." "set needed attributes in the normal way."
msgstr "" msgstr ""
":mod:`unittest.mock` fournit une classe :class:`Mock` pour ne pas avoir "
"besoin de créer manuellement des objets factices dans la suite de tests. "
"Après avoir effectué une action, on peut faire des assertions sur les "
"méthodes / attributs utilisés et les arguments avec lesquels ils ont été "
"appelés. On peut également spécifier des valeurs renvoyées et définir les "
"attributs nécessaires aux tests."
#: ../Doc/library/unittest.mock.rst:27 #: ../Doc/library/unittest.mock.rst:27
msgid "" msgid ""
@ -46,6 +56,11 @@ msgid ""
"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" "some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:"
"`patch`." "`patch`."
msgstr "" msgstr ""
"De plus, *mock* fournit un décorateur :func:`patch` qui est capable de "
"*patcher* les modules et les classes dans la portée d'un test, ainsi que :"
"const:`sentinel` pour créer des objets uniques. Voir le guide rapide `quick "
"guide`_ pour quelques exemples d'utilisation de :class:`Mock`, :class:"
"`MagicMock` et :func:`patch`."
#: ../Doc/library/unittest.mock.rst:33 #: ../Doc/library/unittest.mock.rst:33
msgid "" msgid ""
@ -53,16 +68,22 @@ msgid ""
"is based on the 'action -> assertion' pattern instead of 'record -> replay' " "is based on the 'action -> assertion' pattern instead of 'record -> replay' "
"used by many mocking frameworks." "used by many mocking frameworks."
msgstr "" msgstr ""
"*Mock* est très facile à utiliser et est conçu pour être utilisé avec :mod:"
"`unittest`. *Mock* est basé sur le modèle *action -> assertion* au lieu de "
"*enregistrement -> rejouer* utilisé par de nombreux cadriciels d'objets "
"simulacres."
#: ../Doc/library/unittest.mock.rst:37 #: ../Doc/library/unittest.mock.rst:37
msgid "" msgid ""
"There is a backport of :mod:`unittest.mock` for earlier versions of Python, " "There is a backport of :mod:`unittest.mock` for earlier versions of Python, "
"available as `mock on PyPI <https://pypi.org/project/mock>`_." "available as `mock on PyPI <https://pypi.org/project/mock>`_."
msgstr "" msgstr ""
"Il y a un portage de :mod:`unittest.mock` pour les versions antérieures de "
"Python, disponible `sur PyPI <https://pypi.org/project/mock>`_."
#: ../Doc/library/unittest.mock.rst:42 #: ../Doc/library/unittest.mock.rst:42
msgid "Quick Guide" msgid "Quick Guide"
msgstr "" msgstr "Guide rapide"
#: ../Doc/library/unittest.mock.rst:44 #: ../Doc/library/unittest.mock.rst:44
msgid "" msgid ""
@ -71,12 +92,19 @@ msgid ""
"can configure them, to specify return values or limit what attributes are " "can configure them, to specify return values or limit what attributes are "
"available, and then make assertions about how they have been used:" "available, and then make assertions about how they have been used:"
msgstr "" msgstr ""
"Les classes :class:`Mock` et :class:`MagicMock` créent tous les attributs et "
"méthodes au fur et à mesure des accès et stockent les détails de la façon "
"dont ils ont été utilisés. On peut les configurer, pour spécifier des "
"valeurs de renvoi ou limiter les attributs utilisables, puis faire des "
"assertions sur la façon dont ils ont été utilisés ::"
#: ../Doc/library/unittest.mock.rst:56 #: ../Doc/library/unittest.mock.rst:56
msgid "" msgid ""
":attr:`side_effect` allows you to perform side effects, including raising an " ":attr:`side_effect` allows you to perform side effects, including raising an "
"exception when a mock is called:" "exception when a mock is called:"
msgstr "" msgstr ""
"L'attribut :attr:`side_effect` permet de spécifier des effets de bords, y "
"compris la levée d'une exception lorsqu'un objet simulacre est appelé ::"
#: ../Doc/library/unittest.mock.rst:76 #: ../Doc/library/unittest.mock.rst:76
msgid "" msgid ""
@ -85,6 +113,11 @@ msgid ""
"from another object. Attempting to access attributes or methods on the mock " "from another object. Attempting to access attributes or methods on the mock "
"that don't exist on the spec will fail with an :exc:`AttributeError`." "that don't exist on the spec will fail with an :exc:`AttributeError`."
msgstr "" msgstr ""
"Il existe beaucoup d'autres façons de configurer et de contrôler le "
"comportement de *Mock*. Par exemple, l'argument *spec* configure le *mock* "
"pour qu'il utilise les spécifications d'un autre objet. Tenter d'accéder à "
"des attributs ou méthodes sur le *mock* qui n'existent pas sur l'objet "
"*spec* lève une :exc:`AttributeError`."
#: ../Doc/library/unittest.mock.rst:81 #: ../Doc/library/unittest.mock.rst:81
msgid "" msgid ""
@ -93,6 +126,10 @@ msgid ""
"with a mock (or other object) during the test and restored when the test " "with a mock (or other object) during the test and restored when the test "
"ends:" "ends:"
msgstr "" msgstr ""
"Le décorateur / gestionnaire de contexte :func:`patch` permet de simuler "
"facilement des classes ou des objets dans un module sous tests. L'objet "
"spécifié est remplacé par un objet simulacre (ou autre) pendant le test et "
"est restauré à la fin du test ::"
#: ../Doc/library/unittest.mock.rst:100 #: ../Doc/library/unittest.mock.rst:100
msgid "" msgid ""
@ -101,6 +138,11 @@ msgid ""
"decorators are applied). This means from the bottom up, so in the example " "decorators are applied). This means from the bottom up, so in the example "
"above the mock for ``module.ClassName1`` is passed in first." "above the mock for ``module.ClassName1`` is passed in first."
msgstr "" msgstr ""
"Lorsque l'on imbrique des décorateurs de patchs, les *mocks* sont transmis à "
"la fonction décorée dans le même ordre qu'ils ont été déclarés (l'ordre "
"normal *Python* des décorateurs est appliqué). Cela signifie du bas vers le "
"haut, donc dans l'exemple ci-dessus, l'objet simulacre pour ``module."
"ClassName1`` est passé en premier."
#: ../Doc/library/unittest.mock.rst:105 #: ../Doc/library/unittest.mock.rst:105
msgid "" msgid ""
@ -108,12 +150,17 @@ msgid ""
"they are looked up. This is normally straightforward, but for a quick guide " "they are looked up. This is normally straightforward, but for a quick guide "
"read :ref:`where to patch <where-to-patch>`." "read :ref:`where to patch <where-to-patch>`."
msgstr "" msgstr ""
"Avec :func:`patch`, il est important de *patcher* les objets dans l'espace "
"de nommage où ils sont recherchés. C'est ce qui se fait normalement, mais "
"pour un guide rapide, lisez :ref:`où patcher <where-to-patch>`."
#: ../Doc/library/unittest.mock.rst:109 #: ../Doc/library/unittest.mock.rst:109
msgid "" msgid ""
"As well as a decorator :func:`patch` can be used as a context manager in a " "As well as a decorator :func:`patch` can be used as a context manager in a "
"with statement:" "with statement:"
msgstr "" msgstr ""
"Comme tout décorateur, :func:`patch` peut être utilisé comme gestionnaire de "
"contexte avec une instruction *with* ::"
#: ../Doc/library/unittest.mock.rst:119 #: ../Doc/library/unittest.mock.rst:119
msgid "" msgid ""
@ -121,6 +168,9 @@ msgid ""
"during a scope and restoring the dictionary to its original state when the " "during a scope and restoring the dictionary to its original state when the "
"test ends:" "test ends:"
msgstr "" msgstr ""
"Il existe également :func:`patch.dict` pour définir des valeurs d'un "
"dictionnaire au sein d'une portée et restaurer ce dictionnaire à son état "
"d'origine lorsque le test se termine ::"
#: ../Doc/library/unittest.mock.rst:130 #: ../Doc/library/unittest.mock.rst:130
msgid "" msgid ""
@ -128,6 +178,9 @@ msgid ""
"The easiest way of using magic methods is with the :class:`MagicMock` class. " "The easiest way of using magic methods is with the :class:`MagicMock` class. "
"It allows you to do things like:" "It allows you to do things like:"
msgstr "" msgstr ""
"*Mock* gère le remplacement des :ref:`méthodes magiques <magic-methods>` de "
"Python. La façon la plus simple d'utiliser les méthodes magiques est la "
"classe :class:`MagicMock`. Elle permet de faire des choses comme ::"
#: ../Doc/library/unittest.mock.rst:140 #: ../Doc/library/unittest.mock.rst:140
msgid "" msgid ""
@ -136,12 +189,18 @@ msgid ""
"is just a Mock variant that has all of the magic methods pre-created for you " "is just a Mock variant that has all of the magic methods pre-created for you "
"(well, all the useful ones anyway)." "(well, all the useful ones anyway)."
msgstr "" msgstr ""
"*Mock* permet d'assigner des fonctions (ou d'autres instances *Mock*) à des "
"méthodes magiques et elles seront appelées correctement. La classe :class:"
"`MagicMock` est juste une variante de *Mock* qui a toutes les méthodes "
"magiques pré-créées (enfin, toutes les méthodes utiles)."
#: ../Doc/library/unittest.mock.rst:145 #: ../Doc/library/unittest.mock.rst:145
msgid "" msgid ""
"The following is an example of using magic methods with the ordinary Mock " "The following is an example of using magic methods with the ordinary Mock "
"class:" "class:"
msgstr "" msgstr ""
"L'exemple suivant est un exemple de création de méthodes magiques avec la "
"classe *Mock* ordinaire ::"
#: ../Doc/library/unittest.mock.rst:153 #: ../Doc/library/unittest.mock.rst:153
msgid "" msgid ""
@ -153,12 +212,21 @@ msgid ""
"replacing, and any functions and methods (including constructors) have the " "replacing, and any functions and methods (including constructors) have the "
"same call signature as the real object." "same call signature as the real object."
msgstr "" msgstr ""
"Pour être sûr que les objets simulacres dans vos tests ont la même API que "
"les objets qu'ils remplacent, utilisez :ref:`l'auto-spécification <auto-"
"speccing>`. L'auto-spécification peut se faire via l'argument *autospec* de "
"patch ou par la fonction :func:`create_autospec`. L'auto-spécification crée "
"des objets simulacres qui ont les mêmes attributs et méthodes que les objets "
"qu'ils remplacent, et toutes les fonctions et méthodes (y compris les "
"constructeurs) ont les mêmes signatures d'appel que l'objet réel."
#: ../Doc/library/unittest.mock.rst:161 #: ../Doc/library/unittest.mock.rst:161
msgid "" msgid ""
"This ensures that your mocks will fail in the same way as your production " "This ensures that your mocks will fail in the same way as your production "
"code if they are used incorrectly:" "code if they are used incorrectly:"
msgstr "" msgstr ""
"Ceci garantit que vos objets simulacres échouent de la même manière que "
"votre code de production s'ils ne sont pas utilisés correctement ::"
#: ../Doc/library/unittest.mock.rst:177 #: ../Doc/library/unittest.mock.rst:177
msgid "" msgid ""
@ -166,10 +234,13 @@ msgid ""
"signature of the ``__init__`` method, and on callable objects where it " "signature of the ``__init__`` method, and on callable objects where it "
"copies the signature of the ``__call__`` method." "copies the signature of the ``__call__`` method."
msgstr "" msgstr ""
"La fonction :func:`create_autospec` peut aussi être utilisée sur les "
"classes, où elle copie la signature de la méthode ``__init__``, et sur les "
"objets appelables où elle copie la signature de la méthode ``__call__``."
#: ../Doc/library/unittest.mock.rst:184 #: ../Doc/library/unittest.mock.rst:184
msgid "The Mock Class" msgid "The Mock Class"
msgstr "" msgstr "La classe *Mock*"
#: ../Doc/library/unittest.mock.rst:187 #: ../Doc/library/unittest.mock.rst:187
msgid "" msgid ""
@ -179,6 +250,12 @@ msgid ""
"attribute will always return the same mock. Mocks record how you use them, " "attribute will always return the same mock. Mocks record how you use them, "
"allowing you to make assertions about what your code has done to them." "allowing you to make assertions about what your code has done to them."
msgstr "" msgstr ""
"La classe :class:`Mock` est un objet simulacre flexible destiné à remplacer "
"l'utilisation d'objets bouchons et factices dans votre code. Les Mocks sont "
"appelables et créent des attributs comme de nouveaux *Mocks* lorsque l'on y "
"accède [#]_. L'accès au même attribut renvoie toujours le même *mock*. Les "
"simulacres enregistrent la façon dont ils sont utilisés, ce qui permet de "
"faire des assertions sur ce que le code leur a fait."
#: ../Doc/library/unittest.mock.rst:193 #: ../Doc/library/unittest.mock.rst:193
msgid "" msgid ""
@ -187,6 +264,11 @@ msgid ""
"when you are mocking out objects that aren't callable: :class:" "when you are mocking out objects that aren't callable: :class:"
"`NonCallableMock` and :class:`NonCallableMagicMock`" "`NonCallableMock` and :class:`NonCallableMagicMock`"
msgstr "" msgstr ""
"La classe :class:`MagicMock` est une sous-classe de :class:`Mock` avec "
"toutes les méthodes magiques pré-créées et prête à l'emploi. Il existe "
"également des variantes non appelables, utiles lorsque l'on simule des "
"objets qui ne sont pas appelables : :class:`NonCallableMock` et :class:"
"`NonCallableMagicMock`"
#: ../Doc/library/unittest.mock.rst:198 #: ../Doc/library/unittest.mock.rst:198
msgid "" msgid ""
@ -195,12 +277,18 @@ msgid ""
"will create a :class:`MagicMock` for you. You can specify an alternative " "will create a :class:`MagicMock` for you. You can specify an alternative "
"class of :class:`Mock` using the *new_callable* argument to :func:`patch`." "class of :class:`Mock` using the *new_callable* argument to :func:`patch`."
msgstr "" msgstr ""
"Le décorateur :func:`patch` facilite le remplacement temporaire de classes "
"d'un module avec un objet :class:`Mock`. Par défaut :func:`patch` crée un :"
"class:`MagicMock`. On peut spécifier une classe alternative de :class:`Mock` "
"en utilisant le paramètre *new_callable* de :func:`patch`."
#: ../Doc/library/unittest.mock.rst:206 #: ../Doc/library/unittest.mock.rst:206
msgid "" msgid ""
"Create a new :class:`Mock` object. :class:`Mock` takes several optional " "Create a new :class:`Mock` object. :class:`Mock` takes several optional "
"arguments that specify the behaviour of the Mock object:" "arguments that specify the behaviour of the Mock object:"
msgstr "" msgstr ""
"Crée un nouvel objet :class:`Mock`. :class:`Mock` prend plusieurs arguments "
"optionnels qui spécifient le comportement de l'objet *Mock* ::"
#: ../Doc/library/unittest.mock.rst:209 #: ../Doc/library/unittest.mock.rst:209
msgid "" msgid ""
@ -210,6 +298,12 @@ msgid ""
"(excluding unsupported magic attributes and methods). Accessing any " "(excluding unsupported magic attributes and methods). Accessing any "
"attribute not in this list will raise an :exc:`AttributeError`." "attribute not in this list will raise an :exc:`AttributeError`."
msgstr "" msgstr ""
"*spec* : une liste de chaînes de caractères ou un objet existant (une classe "
"ou une instance) qui sert de spécification pour l'objet simulacre. Si on "
"passe un objet, alors une liste de chaînes de caractères est formée en "
"appelant la fonction *dir* sur l'objet (à l'exclusion des attributs et "
"méthodes magiques non pris en charge). L'accès à un attribut qui n'est pas "
"dans cette liste entraîne la levée d'une exception :exc:`AttributeError`."
#: ../Doc/library/unittest.mock.rst:215 #: ../Doc/library/unittest.mock.rst:215
msgid "" msgid ""
@ -217,6 +311,9 @@ msgid ""
"__class__` returns the class of the spec object. This allows mocks to pass :" "__class__` returns the class of the spec object. This allows mocks to pass :"
"func:`isinstance` tests." "func:`isinstance` tests."
msgstr "" msgstr ""
"Si *spec* est un objet (plutôt qu'une liste de chaînes de caractères) alors :"
"attr:`~instance.__class__` renvoie la classe de l'objet spécifié. Ceci "
"permet aux *mocks* de passer les tests :func:`isinstance`."
#: ../Doc/library/unittest.mock.rst:219 #: ../Doc/library/unittest.mock.rst:219
msgid "" msgid ""
@ -224,6 +321,10 @@ msgid ""
"get an attribute on the mock that isn't on the object passed as *spec_set* " "get an attribute on the mock that isn't on the object passed as *spec_set* "
"will raise an :exc:`AttributeError`." "will raise an :exc:`AttributeError`."
msgstr "" msgstr ""
"*spec_set* : variante plus stricte de *spec*. S'il est utilisé, essayer "
"d'utiliser la fonction *set* ou tenter daccéder à un attribut sur le *mock* "
"qui n'est pas sur l'objet passé comme *spec_set* lève une exception :exc:"
"`AttributeError`."
#: ../Doc/library/unittest.mock.rst:223 #: ../Doc/library/unittest.mock.rst:223
msgid "" msgid ""
@ -233,22 +334,32 @@ msgid ""
"arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return "
"value of this function is used as the return value." "value of this function is used as the return value."
msgstr "" msgstr ""
"*side_effect* : fonction à appeler à chaque fois que le *Mock* est appelé. "
"Voir l'attribut :attr:`~Mock.side_effect`. Utile pour lever des exceptions "
"ou modifier dynamiquement les valeurs de retour. La fonction est appelée "
"avec les mêmes arguments que la fonction simulée et, à moins qu'elle ne "
"renvoie :data:`DEFAULT`, la valeur de retour de cette fonction devient la "
"valeur de retour de la fonction simulée."
#: ../Doc/library/unittest.mock.rst:229 #: ../Doc/library/unittest.mock.rst:229
msgid "" msgid ""
"Alternatively *side_effect* can be an exception class or instance. In this " "Alternatively *side_effect* can be an exception class or instance. In this "
"case the exception will be raised when the mock is called." "case the exception will be raised when the mock is called."
msgstr "" msgstr ""
"*side_effect* peut être soit une classe, soit une instance d'exception. Dans "
"ce cas, l'exception est levée lors de l'appel de l'objet simulacre."
#: ../Doc/library/unittest.mock.rst:232 #: ../Doc/library/unittest.mock.rst:232
msgid "" msgid ""
"If *side_effect* is an iterable then each call to the mock will return the " "If *side_effect* is an iterable then each call to the mock will return the "
"next value from the iterable." "next value from the iterable."
msgstr "" msgstr ""
"Si *side_effect* est un itérable alors chaque appel au *mock* renvoie la "
"valeur suivante de litérable."
#: ../Doc/library/unittest.mock.rst:235 #: ../Doc/library/unittest.mock.rst:235
msgid "A *side_effect* can be cleared by setting it to ``None``." msgid "A *side_effect* can be cleared by setting it to ``None``."
msgstr "" msgstr "Utilisez ``None`` pour remettre à zéro un *side_effect*."
#: ../Doc/library/unittest.mock.rst:237 #: ../Doc/library/unittest.mock.rst:237
msgid "" msgid ""
@ -256,6 +367,9 @@ msgid ""
"is a new Mock (created on first access). See the :attr:`return_value` " "is a new Mock (created on first access). See the :attr:`return_value` "
"attribute." "attribute."
msgstr "" msgstr ""
"*return_value* : valeur renvoyée lors de l'appel de l'objet simulacre. Par "
"défaut, il s'agit d'un nouveau *Mock* (créé lors du premier accès). Voir "
"l'attribut :attr:`return_value`."
#: ../Doc/library/unittest.mock.rst:241 #: ../Doc/library/unittest.mock.rst:241
msgid "" msgid ""
@ -263,6 +377,9 @@ msgid ""
"raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to " "raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to "
"these attributes." "these attributes."
msgstr "" msgstr ""
"*unsafe* : par défaut, si un attribut commence par *assert* ou *assret*, une "
"exception :exc:`AttributeError` est levée. Le fait de passer ``unsafe=True`` "
"permet d'accéder à ces attributs."
#: ../Doc/library/unittest.mock.rst:247 #: ../Doc/library/unittest.mock.rst:247
msgid "" msgid ""
@ -273,18 +390,30 @@ msgid ""
"to access an attribute that doesn't exist will raise an :exc:" "to access an attribute that doesn't exist will raise an :exc:"
"`AttributeError`)." "`AttributeError`)."
msgstr "" msgstr ""
"*wraps* : élément que le simulacre doit simuler. Si *wraps* n'est pas "
"``None`` alors appeler *Mock* passe l'appel à l'objet simulé (renvoyant le "
"résultat réel). L'accès à un attribut sur le *mock* renvoie un objet *Mock* "
"qui simule l'attribut correspondant de l'objet simulé (donc essayer "
"d'accéder à un attribut qui n'existe pas lève une exception :exc:"
"`AttributeError`)."
#: ../Doc/library/unittest.mock.rst:254 #: ../Doc/library/unittest.mock.rst:254
msgid "" msgid ""
"If the mock has an explicit *return_value* set then calls are not passed to " "If the mock has an explicit *return_value* set then calls are not passed to "
"the wrapped object and the *return_value* is returned instead." "the wrapped object and the *return_value* is returned instead."
msgstr "" msgstr ""
"Si l'objet simulacre a un ensemble explicite de *return_value* alors les "
"appels ne sont pas passés à l'objet simulé et c'est *return_value* qui est "
"renvoyée à la place."
#: ../Doc/library/unittest.mock.rst:257 #: ../Doc/library/unittest.mock.rst:257
msgid "" msgid ""
"*name*: If the mock has a name then it will be used in the repr of the mock. " "*name*: If the mock has a name then it will be used in the repr of the mock. "
"This can be useful for debugging. The name is propagated to child mocks." "This can be useful for debugging. The name is propagated to child mocks."
msgstr "" msgstr ""
"*name* : Si le *mock* a un nom, il est alors utilisé par la fonction *repr* "
"du *mock*. C'est utile pour le débogage. Le nom est propagé aux enfants de "
"l'objet *mock*."
#: ../Doc/library/unittest.mock.rst:261 #: ../Doc/library/unittest.mock.rst:261
msgid "" msgid ""
@ -292,30 +421,38 @@ msgid ""
"used to set attributes on the mock after it is created. See the :meth:" "used to set attributes on the mock after it is created. See the :meth:"
"`configure_mock` method for details." "`configure_mock` method for details."
msgstr "" msgstr ""
"Les *mocks* peuvent aussi être appelés avec des arguments par mots-clés "
"arbitraires. Ceux-ci sont utilisés pour définir les attributs sur le *mock* "
"après sa création. Voir la méthode :meth:`configure_mock` pour plus de "
"détails."
#: ../Doc/library/unittest.mock.rst:267 #: ../Doc/library/unittest.mock.rst:267
msgid "Assert that the mock was called at least once." msgid "Assert that the mock was called at least once."
msgstr "" msgstr "Asserter que le *mock* a été appelé au moins une fois."
#: ../Doc/library/unittest.mock.rst:278 #: ../Doc/library/unittest.mock.rst:278
msgid "Assert that the mock was called exactly once." msgid "Assert that the mock was called exactly once."
msgstr "" msgstr "Asserter que le *mock* a été appelé exactement une fois."
#: ../Doc/library/unittest.mock.rst:296 #: ../Doc/library/unittest.mock.rst:296
msgid "" msgid ""
"This method is a convenient way of asserting that calls are made in a " "This method is a convenient way of asserting that calls are made in a "
"particular way:" "particular way:"
msgstr "" msgstr ""
"Cette méthode est un moyen pratique d'asserter que les appels sont effectués "
"d'une manière particulière ::"
#: ../Doc/library/unittest.mock.rst:306 #: ../Doc/library/unittest.mock.rst:306
msgid "" msgid ""
"Assert that the mock was called exactly once and that that call was with the " "Assert that the mock was called exactly once and that that call was with the "
"specified arguments." "specified arguments."
msgstr "" msgstr ""
"Asserter que le simulacre a été appelé exactement une fois et que cet appel "
"était avec les arguments spécifiés."
#: ../Doc/library/unittest.mock.rst:321 #: ../Doc/library/unittest.mock.rst:321
msgid "assert the mock has been called with the specified arguments." msgid "assert the mock has been called with the specified arguments."
msgstr "" msgstr "Asserter que le simulacre a été appelé avec les arguments spécifiés."
#: ../Doc/library/unittest.mock.rst:323 #: ../Doc/library/unittest.mock.rst:323
msgid "" msgid ""
@ -324,36 +461,50 @@ msgid ""
"the call is the most recent one, and in the case of :meth:" "the call is the most recent one, and in the case of :meth:"
"`assert_called_once_with` it must also be the only call." "`assert_called_once_with` it must also be the only call."
msgstr "" msgstr ""
"Asserter que le simulacre a *bien* été appelé avec les arguments au cours de "
"la vie du simulacre. Contrairement à :meth:`assert_called_with` et :meth:"
"`assert_called_once_with` qui passent seulement si l'appel demandé "
"correspond bien au dernier appel, et dans le cas de :meth:"
"`assert_called_once_with` l'appel au simulacre doit être unique."
#: ../Doc/library/unittest.mock.rst:336 #: ../Doc/library/unittest.mock.rst:336
msgid "" msgid ""
"assert the mock has been called with the specified calls. The :attr:" "assert the mock has been called with the specified calls. The :attr:"
"`mock_calls` list is checked for the calls." "`mock_calls` list is checked for the calls."
msgstr "" msgstr ""
"Asserter que le simulacre a été appelé avec les appels spécifiés. "
"L'attribut :attr:`mock_calls` est comparé à la liste des appels."
#: ../Doc/library/unittest.mock.rst:339 #: ../Doc/library/unittest.mock.rst:339
msgid "" msgid ""
"If *any_order* is false (the default) then the calls must be sequential. " "If *any_order* is false (the default) then the calls must be sequential. "
"There can be extra calls before or after the specified calls." "There can be extra calls before or after the specified calls."
msgstr "" msgstr ""
"Si *any_order* est faux (la valeur par défaut) alors les appels doivent être "
"séquentiels. Il peut y avoir des appels supplémentaires avant ou après les "
"appels spécifiés."
#: ../Doc/library/unittest.mock.rst:343 #: ../Doc/library/unittest.mock.rst:343
msgid "" msgid ""
"If *any_order* is true then the calls can be in any order, but they must all " "If *any_order* is true then the calls can be in any order, but they must all "
"appear in :attr:`mock_calls`." "appear in :attr:`mock_calls`."
msgstr "" msgstr ""
"Si *any_order* est vrai alors les appels peuvent être dans n'importe quel "
"ordre, mais ils doivent tous apparaître dans :attr:`mock_calls`."
#: ../Doc/library/unittest.mock.rst:358 #: ../Doc/library/unittest.mock.rst:358
msgid "Assert the mock was never called." msgid "Assert the mock was never called."
msgstr "" msgstr "Asserter que le simulacre n'a jamais été appelé."
#: ../Doc/library/unittest.mock.rst:373 #: ../Doc/library/unittest.mock.rst:373
msgid "The reset_mock method resets all the call attributes on a mock object:" msgid "The reset_mock method resets all the call attributes on a mock object:"
msgstr "" msgstr ""
"La méthode *reset_mock* réinitialise tous les attributs d'appel sur un "
"simulacre :"
#: ../Doc/library/unittest.mock.rst:383 #: ../Doc/library/unittest.mock.rst:383
msgid "Added two keyword only argument to the reset_mock function." msgid "Added two keyword only argument to the reset_mock function."
msgstr "" msgstr "Ajout de deux arguments nommés à la fonction *reset_mock*."
#: ../Doc/library/unittest.mock.rst:386 #: ../Doc/library/unittest.mock.rst:386
msgid "" msgid ""
@ -364,20 +515,34 @@ msgid ""
"`side_effect`, then pass the corresponding parameter as ``True``. Child " "`side_effect`, then pass the corresponding parameter as ``True``. Child "
"mocks and the return value mock (if any) are reset as well." "mocks and the return value mock (if any) are reset as well."
msgstr "" msgstr ""
"Utile pour faire une série d'assertions qui réutilisent le même objet. "
"Attention :meth:`reset_mock` *ne réinitialise pas* la valeur de retour, les :"
"attr:`side_effect` ou tout attribut enfant que vous avez défini en utilisant "
"l'affectation normale par défaut. Pour réinitialiser *return_value* ou :attr:"
"`side_effect`, utiliser les paramètres correspondants avec la valeur "
"``True``. Les simulacres enfants et le simulacre de valeur de retour (le cas "
"échéant) seront également réinitialisés."
#: ../Doc/library/unittest.mock.rst:394 #: ../Doc/library/unittest.mock.rst:394
msgid "*return_value*, and :attr:`side_effect` are keyword only argument." msgid "*return_value*, and :attr:`side_effect` are keyword only argument."
msgstr "" msgstr ""
"*return_value*, et :attr:`side_effect` sont utilisable uniquement par "
"arguments nommés."
#: ../Doc/library/unittest.mock.rst:400 #: ../Doc/library/unittest.mock.rst:400
msgid "" msgid ""
"Add a spec to a mock. *spec* can either be an object or a list of strings. " "Add a spec to a mock. *spec* can either be an object or a list of strings. "
"Only attributes on the *spec* can be fetched as attributes from the mock." "Only attributes on the *spec* can be fetched as attributes from the mock."
msgstr "" msgstr ""
"Ajoute une spécification à un simulacre. *spec* peut être un objet ou une "
"liste de chaînes de caractères. Seuls les attributs de la spécification "
"*spec* peuvent être récupérés en tant qu'attributs du simulacre."
#: ../Doc/library/unittest.mock.rst:404 #: ../Doc/library/unittest.mock.rst:404
msgid "If *spec_set* is true then only attributes on the spec can be set." msgid "If *spec_set* is true then only attributes on the spec can be set."
msgstr "" msgstr ""
"Si *spec_set* est vrai, seuls les attributs de la spécification peuvent être "
"définis."
#: ../Doc/library/unittest.mock.rst:409 #: ../Doc/library/unittest.mock.rst:409
msgid "" msgid ""
@ -385,26 +550,37 @@ msgid ""
"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" "Calls to the attached mock will be recorded in the :attr:`method_calls` and :"
"attr:`mock_calls` attributes of this one." "attr:`mock_calls` attributes of this one."
msgstr "" msgstr ""
"Attache un simulacre comme attribut de l'instance courante, en remplaçant "
"son nom et son parent. Les appels au simulacre attaché sont enregistrés dans "
"les attributs :attr:`method_calls` et :attr:`mock_calls` de l'instance "
"courante."
#: ../Doc/library/unittest.mock.rst:416 #: ../Doc/library/unittest.mock.rst:416
msgid "Set attributes on the mock through keyword arguments." msgid "Set attributes on the mock through keyword arguments."
msgstr "" msgstr "Définir les attributs sur le simulacre à l'aide d'arguments nommés."
#: ../Doc/library/unittest.mock.rst:418 #: ../Doc/library/unittest.mock.rst:418
msgid "" msgid ""
"Attributes plus return values and side effects can be set on child mocks " "Attributes plus return values and side effects can be set on child mocks "
"using standard dot notation and unpacking a dictionary in the method call:" "using standard dot notation and unpacking a dictionary in the method call:"
msgstr "" msgstr ""
"Les attributs, les valeurs de retour et les effets de bords peuvent être "
"définis sur des simulacres enfants en utilisant la notation par points "
"standard et en dépaquetant un dictionnaire dans l'appel de méthode :"
#: ../Doc/library/unittest.mock.rst:432 #: ../Doc/library/unittest.mock.rst:432
msgid "The same thing can be achieved in the constructor call to mocks:" msgid "The same thing can be achieved in the constructor call to mocks:"
msgstr "" msgstr ""
"La même chose peut être réalisée en utilisant le constructeur des "
"simulacres :"
#: ../Doc/library/unittest.mock.rst:445 #: ../Doc/library/unittest.mock.rst:445
msgid "" msgid ""
":meth:`configure_mock` exists to make it easier to do configuration after " ":meth:`configure_mock` exists to make it easier to do configuration after "
"the mock has been created." "the mock has been created."
msgstr "" msgstr ""
":meth:`configure_mock` existe pour faciliter la configuration après la "
"création du simulacre."
#: ../Doc/library/unittest.mock.rst:451 #: ../Doc/library/unittest.mock.rst:451
msgid "" msgid ""
@ -412,12 +588,17 @@ msgid ""
"results. For mocks with a *spec* this includes all the permitted attributes " "results. For mocks with a *spec* this includes all the permitted attributes "
"for the mock." "for the mock."
msgstr "" msgstr ""
"Les objets :class:`Mock` limitent les résultats de ``dir(un_mock)`` à des "
"résultats utiles. Pour les simulacres avec une spécification *spec*, cela "
"inclut tous les attributs autorisés du simulacre."
#: ../Doc/library/unittest.mock.rst:455 #: ../Doc/library/unittest.mock.rst:455
msgid "" msgid ""
"See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "See :data:`FILTER_DIR` for what this filtering does, and how to switch it "
"off." "off."
msgstr "" msgstr ""
"Voir :data:`FILTER_DIR` pour savoir ce que fait ce filtrage, et comment le "
"désactiver."
#: ../Doc/library/unittest.mock.rst:461 #: ../Doc/library/unittest.mock.rst:461
msgid "" msgid ""
@ -425,40 +606,53 @@ msgid ""
"mocks will be the same type as the parent. Subclasses of Mock may want to " "mocks will be the same type as the parent. Subclasses of Mock may want to "
"override this to customize the way child mocks are made." "override this to customize the way child mocks are made."
msgstr "" msgstr ""
"Crée les simulacres enfants pour les attributs et la valeur de retour. Par "
"défaut, les objets simulacre enfants sont du même type que le parent. Les "
"sous-classes de *Mock* peuvent surcharger cette méthode pour personnaliser "
"la façon dont les simulacres enfants sont créés."
#: ../Doc/library/unittest.mock.rst:466 #: ../Doc/library/unittest.mock.rst:466
msgid "" msgid ""
"For non-callable mocks the callable variant will be used (rather than any " "For non-callable mocks the callable variant will be used (rather than any "
"custom subclass)." "custom subclass)."
msgstr "" msgstr ""
"Pour les simulacres non appelables, la variante appelable est utilisée "
"(plutôt qu'une sous-classe personnalisée)."
#: ../Doc/library/unittest.mock.rst:472 #: ../Doc/library/unittest.mock.rst:472
msgid "A boolean representing whether or not the mock object has been called:" msgid "A boolean representing whether or not the mock object has been called:"
msgstr "" msgstr "Un booléen représentant si le simulacre a bien été appelé ou non :"
#: ../Doc/library/unittest.mock.rst:483 #: ../Doc/library/unittest.mock.rst:483
msgid "An integer telling you how many times the mock object has been called:" msgid "An integer telling you how many times the mock object has been called:"
msgstr "" msgstr "Un entier indiquant combien de fois le simulacre a été appelé :"
#: ../Doc/library/unittest.mock.rst:496 #: ../Doc/library/unittest.mock.rst:496
msgid "Set this to configure the value returned by calling the mock:" msgid "Set this to configure the value returned by calling the mock:"
msgstr "" msgstr ""
"Définir cette option pour configurer la valeur renvoyé par appel du "
"simulacre :"
#: ../Doc/library/unittest.mock.rst:503 #: ../Doc/library/unittest.mock.rst:503
msgid "" msgid ""
"The default return value is a mock object and you can configure it in the " "The default return value is a mock object and you can configure it in the "
"normal way:" "normal way:"
msgstr "" msgstr ""
"La valeur de revoie par défaut est un simulacre configurable normalement :"
#: ../Doc/library/unittest.mock.rst:512 #: ../Doc/library/unittest.mock.rst:512
msgid ":attr:`return_value` can also be set in the constructor:" msgid ":attr:`return_value` can also be set in the constructor:"
msgstr "" msgstr ""
"L'attribut :attr:`return_value` peut également être défini dans le "
"constructeur :"
#: ../Doc/library/unittest.mock.rst:523 #: ../Doc/library/unittest.mock.rst:523
msgid "" msgid ""
"This can either be a function to be called when the mock is called, an " "This can either be a function to be called when the mock is called, an "
"iterable or an exception (class or instance) to be raised." "iterable or an exception (class or instance) to be raised."
msgstr "" msgstr ""
"C'est soit une fonction à appeler lors de l'appel du simulacre, soit une "
"exception (classe ou instance) à lever."
#: ../Doc/library/unittest.mock.rst:526 #: ../Doc/library/unittest.mock.rst:526
msgid "" msgid ""
@ -468,6 +662,11 @@ msgid ""
"returns :data:`DEFAULT` then the mock will return its normal value (from " "returns :data:`DEFAULT` then the mock will return its normal value (from "
"the :attr:`return_value`)." "the :attr:`return_value`)."
msgstr "" msgstr ""
"Si vous passez une fonction, elle est appelée avec les mêmes arguments que "
"la fonction simulée et à moins que la fonction ne renvoie le singleton :data:"
"`DEFAULT` l'appel le la fonction simulée renvoie ce que la fonction renvoie. "
"Si la fonction renvoie :data:`DEFAULT` alors le simulacre renvoie sa valeur "
"normale (celle de :attr:`return_value`)."
#: ../Doc/library/unittest.mock.rst:532 #: ../Doc/library/unittest.mock.rst:532
msgid "" msgid ""
@ -476,30 +675,39 @@ msgid ""
"to be raised, or a value to be returned from the call to the mock (:data:" "to be raised, or a value to be returned from the call to the mock (:data:"
"`DEFAULT` handling is identical to the function case)." "`DEFAULT` handling is identical to the function case)."
msgstr "" msgstr ""
"Si vous passez un itérable, il est utilisé pour récupérer un itérateur qui "
"doit renvoyer une valeur à chaque appel. Cette valeur peut être soit une "
"instance d'exception à lever, soit une valeur à renvoyer à l'appel au "
"simulacre (le traitement :data:`DEFAULT` est identique au renvoie de la "
"fonction simulée)."
#: ../Doc/library/unittest.mock.rst:537 #: ../Doc/library/unittest.mock.rst:537
msgid "" msgid ""
"An example of a mock that raises an exception (to test exception handling of " "An example of a mock that raises an exception (to test exception handling of "
"an API):" "an API):"
msgstr "" msgstr ""
"Un exemple d'un simulacre qui lève une exception (pour tester la gestion des "
"exceptions d'une API) :"
#: ../Doc/library/unittest.mock.rst:547 #: ../Doc/library/unittest.mock.rst:547
msgid "Using :attr:`side_effect` to return a sequence of values:" msgid "Using :attr:`side_effect` to return a sequence of values:"
msgstr "" msgstr "Utiliser :attr:`side_effect` pour renvoyer une séquence de valeurs :"
#: ../Doc/library/unittest.mock.rst:554 #: ../Doc/library/unittest.mock.rst:554
msgid "Using a callable:" msgid "Using a callable:"
msgstr "" msgstr "Utilisation d'un objet appelable :"
#: ../Doc/library/unittest.mock.rst:564 #: ../Doc/library/unittest.mock.rst:564
msgid "" msgid ""
":attr:`side_effect` can be set in the constructor. Here's an example that " ":attr:`side_effect` can be set in the constructor. Here's an example that "
"adds one to the value the mock is called with and returns it:" "adds one to the value the mock is called with and returns it:"
msgstr "" msgstr ""
"Un attribut :attr:`side_effect` peut être défini dans le constructeur. Voici "
"un exemple qui ajoute un à la valeur du simulacre appelé et qui le renvoie :"
#: ../Doc/library/unittest.mock.rst:574 #: ../Doc/library/unittest.mock.rst:574
msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgid "Setting :attr:`side_effect` to ``None`` clears it:"
msgstr "" msgstr "Positionner :attr:`side_effect` sur ``None`` l'efface :"
#: ../Doc/library/unittest.mock.rst:588 #: ../Doc/library/unittest.mock.rst:588
msgid "" msgid ""
@ -509,6 +717,11 @@ msgid ""
"tuple) and the second member is any keyword arguments (or an empty " "tuple) and the second member is any keyword arguments (or an empty "
"dictionary)." "dictionary)."
msgstr "" msgstr ""
"C'est soit ``None`` (si le simulacre n'a pas été appelé), soit les arguments "
"avec lesquels le simulacre a été appelé en dernier. Le retour est sous la "
"forme d'un tuple : le premier élément est l'ensemble des arguments ordonnés "
"avec lequel le simulacre a été appelé (ou un tuple vide) et le second "
"élément est l'ensemble des arguments nommés (ou un dictionnaire vide)."
#: ../Doc/library/unittest.mock.rst:611 #: ../Doc/library/unittest.mock.rst:611
msgid "" msgid ""
@ -517,6 +730,11 @@ msgid ""
"are tuples, so they can be unpacked to get at the individual arguments and " "are tuples, so they can be unpacked to get at the individual arguments and "
"make more complex assertions. See :ref:`calls as tuples <calls-as-tuples>`." "make more complex assertions. See :ref:`calls as tuples <calls-as-tuples>`."
msgstr "" msgstr ""
"L'attribut :attr:`call_args`, ainsi que les éléments des listes :attr:"
"`call_args_list`, :attr:`method_calls` et :attr:`mock_calls` sont des "
"objets :data:`call`. Ce sont des tuples, que l'on peut dépaqueter afin de "
"faire des affirmations plus complexes sur chacun des arguments. Voir :ref:"
"`appels comme tuples <calls-as-tuples>`."
#: ../Doc/library/unittest.mock.rst:620 #: ../Doc/library/unittest.mock.rst:620
msgid "" msgid ""