From 86ce4afab5ac97d299d70f242b992d301c3d56f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Sun, 31 Mar 2019 12:44:53 +0200 Subject: [PATCH 01/10] Working on library/unittest.mock.po --- library/unittest.mock.po | 1374 +++++++++++++------------------------- 1 file changed, 446 insertions(+), 928 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index b9ed3df03..9d6a98bda 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,244 +6,226 @@ msgstr "" "Project-Id-Version: Python 3.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-03-20 09:03+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2019-03-31 12:43+0200\n" "Language-Team: FRENCH \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Last-Translator: Bousquié Pierre \n" +"X-Generator: Poedit 2.2.1\n" #: ../Doc/library/unittest.mock.rst:3 msgid ":mod:`unittest.mock` --- mock object library" -msgstr "" +msgstr ":mod:`unittest.mock` --- Bibliothèque d'objets simulacres" #: ../Doc/library/unittest.mock.rst:13 msgid "**Source code:** :source:`Lib/unittest/mock.py`" -msgstr "" +msgstr "**Code source :** :source:`Lib/unittest/mock.py`" #: ../Doc/library/unittest.mock.rst:17 msgid "" -":mod:`unittest.mock` is a library for testing in Python. It allows you to " -"replace parts of your system under test with mock objects and make " -"assertions about how they have been used." +":mod:`unittest.mock` is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have " +"been used." 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 msgid "" -":mod:`unittest.mock` provides a core :class:`Mock` class removing the need " -"to create a host of stubs throughout your test suite. After performing an " -"action, you can make assertions about which methods / attributes were used " -"and arguments they were called with. You can also specify return values and " -"set needed attributes in the normal way." +":mod:`unittest.mock` provides a core :class:`Mock` class removing the need to create a host of stubs throughout your test suite. After performing an action, you can make " +"assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set needed attributes in the normal way." 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 msgid "" -"Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along with :" -"const:`sentinel` for creating unique objects. See the `quick guide`_ for " -"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" -"`patch`." +"Additionally, mock provides a :func:`patch` decorator that handles patching module and class level attributes within the scope of a test, along with :const:`sentinel` for " +"creating unique objects. See the `quick guide`_ for some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:`patch`." msgstr "" +"De plus, *mock* fournit un décorateur :func:`patch` qui est capable de *patcher* les module 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 msgid "" -"Mock is very easy to use and is designed for use with :mod:`unittest`. Mock " -"is based on the 'action -> assertion' pattern instead of 'record -> replay' " -"used by many mocking frameworks." +"Mock is very easy to use and is designed for use with :mod:`unittest`. Mock is based on the 'action -> assertion' pattern instead of 'record -> replay' used by many mocking " +"frameworks." 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 frameworks d'objets simulacres." #: ../Doc/library/unittest.mock.rst:37 -msgid "" -"There is a backport of :mod:`unittest.mock` for earlier versions of Python, " -"available as `mock on PyPI `_." -msgstr "" +msgid "There is a backport of :mod:`unittest.mock` for earlier versions of Python, available as `mock on PyPI `_." +msgstr "Il y a un portage de :mod:`unittest.mock` pour les versions antérieures de Python, disponible `sur PyPI `_." #: ../Doc/library/unittest.mock.rst:42 msgid "Quick Guide" -msgstr "" +msgstr "Guide rapide" #: ../Doc/library/unittest.mock.rst:44 msgid "" -":class:`Mock` and :class:`MagicMock` objects create all attributes and " -"methods as you access them and store details of how they have been used. You " -"can configure them, to specify return values or limit what attributes are " -"available, and then make assertions about how they have been used:" +":class:`Mock` and :class:`MagicMock` objects create all attributes and methods as you access them and store details of how they have been used. You can configure them, to " +"specify return values or limit what attributes are available, and then make assertions about how they have been used:" 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 renvoie 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 -msgid "" -":attr:`side_effect` allows you to perform side effects, including raising an " -"exception when a mock is called:" -msgstr "" +msgid ":attr:`side_effect` allows you to perform side effects, including raising an exception when a mock is called:" +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 msgid "" -"Mock has many other ways you can configure it and control its behaviour. For " -"example the *spec* argument configures the mock to take its specification " -"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`." +"Mock has many other ways you can configure it and control its behaviour. For example the *spec* argument configures the mock to take its specification 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`." msgstr "" +"*Mock* a beaucoup d'autres façons de configurer et de contrôler son comportement. 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 spécifiant lève une :exc:`AttributeError`." #: ../Doc/library/unittest.mock.rst:81 msgid "" -"The :func:`patch` decorator / context manager makes it easy to mock classes " -"or objects in a module under test. The object you specify will be replaced " -"with a mock (or other object) during the test and restored when the test " -"ends:" +"The :func:`patch` decorator / context manager makes it easy to mock classes or objects in a module under test. The object you specify will be replaced with a mock (or other " +"object) during the test and restored when the test ends:" 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 msgid "" -"When you nest patch decorators the mocks are passed in to the decorated " -"function in the same order they applied (the normal *Python* order that " -"decorators are applied). This means from the bottom up, so in the example " -"above the mock for ``module.ClassName1`` is passed in first." +"When you nest patch decorators the mocks are passed in to the decorated function in the same order they applied (the normal *Python* order that decorators are applied). This " +"means from the bottom up, so in the example above the mock for ``module.ClassName1`` is passed in first." 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 msgid "" -"With :func:`patch` it matters that you patch objects in the namespace where " -"they are looked up. This is normally straightforward, but for a quick guide " -"read :ref:`where to patch `." +"With :func:`patch` it matters that you patch objects in the namespace where they are looked up. This is normally straightforward, but for a quick guide read :ref:`where to " +"patch `." msgstr "" +"Avec :func:`patch`, il est important de patcher les objets dans l'espace de noms où ils sont recherchés. C'est normalement directe, mais pour un guide rapide, lisez :ref:`où " +"patcher `." #: ../Doc/library/unittest.mock.rst:109 -msgid "" -"As well as a decorator :func:`patch` can be used as a context manager in a " -"with statement:" -msgstr "" +msgid "As well as a decorator :func:`patch` can be used as a context manager in a with statement:" +msgstr "Comme tout décorateur :func:`patch` peut être utilisé comme gestionnaire de contexte avec une instruction *with* ::" #: ../Doc/library/unittest.mock.rst:119 -msgid "" -"There is also :func:`patch.dict` for setting values in a dictionary just " -"during a scope and restoring the dictionary to its original state when the " -"test ends:" +msgid "There is also :func:`patch.dict` for setting values in a dictionary just during a scope and restoring the dictionary to its original state when the test ends:" 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 msgid "" -"Mock supports the mocking of Python :ref:`magic methods `. " -"The easiest way of using magic methods is with the :class:`MagicMock` class. " -"It allows you to do things like:" +"Mock supports the mocking of Python :ref:`magic methods `. The easiest way of using magic methods is with the :class:`MagicMock` class. It allows you to do " +"things like:" msgstr "" +"*Mock* supporte le remplacement des :ref:`méthodes magiques ` 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 msgid "" -"Mock allows you to assign functions (or other Mock instances) to magic " -"methods and they will be called appropriately. The :class:`MagicMock` class " -"is just a Mock variant that has all of the magic methods pre-created for you " -"(well, all the useful ones anyway)." +"Mock allows you to assign functions (or other Mock instances) to magic methods and they will be called appropriately. The :class:`MagicMock` class is just a Mock variant " +"that has all of the magic methods pre-created for you (well, all the useful ones anyway)." 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 -msgid "" -"The following is an example of using magic methods with the ordinary Mock " -"class:" -msgstr "" +msgid "The following is an example of using magic methods with the ordinary Mock class:" +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 msgid "" -"For ensuring that the mock objects in your tests have the same api as the " -"objects they are replacing, you can use :ref:`auto-speccing `. Auto-speccing can be done through the *autospec* argument to " -"patch, or the :func:`create_autospec` function. Auto-speccing creates mock " -"objects that have the same attributes and methods as the objects they are " -"replacing, and any functions and methods (including constructors) have the " -"same call signature as the real object." +"For ensuring that the mock objects in your tests have the same api as the objects they are replacing, you can use :ref:`auto-speccing `. Auto-speccing can be " +"done through the *autospec* argument to patch, or the :func:`create_autospec` function. Auto-speccing creates mock objects that have the same attributes and methods as the " +"objects they are replacing, and any functions and methods (including constructors) have the same call signature as the real object." msgstr "" +"Pour assurer que les objets simulacres dans vos tests ont la même API que les objets qu'ils remplacent. Utiliser :ref:`l'auto-spécification `. L'auto-" +"spécification peut se faire via l'argument *autospec* de patch, ou 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 -msgid "" -"This ensures that your mocks will fail in the same way as your production " -"code if they are used incorrectly:" -msgstr "" +msgid "This ensures that your mocks will fail in the same way as your production code if they are used incorrectly:" +msgstr "Ceci garantit que vos objets simulacres échoueront de la même manière que votre code de production si ils sont utilisées incorrectement ::" #: ../Doc/library/unittest.mock.rst:177 msgid "" -":func:`create_autospec` can also be used on classes, where it copies the " -"signature of the ``__init__`` method, and on callable objects where it " -"copies the signature of the ``__call__`` method." +":func:`create_autospec` can also be used on classes, where it copies the signature of the ``__init__`` method, and on callable objects where it copies the signature of the " +"``__call__`` method." msgstr "" +"La fonction :func:`create_autospec` peut aussi être utilisé 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 msgid "The Mock Class" -msgstr "" +msgstr "La classe *Mock*" #: ../Doc/library/unittest.mock.rst:187 msgid "" -":class:`Mock` is a flexible mock object intended to replace the use of stubs " -"and test doubles throughout your code. Mocks are callable and create " -"attributes as new mocks when you access them [#]_. Accessing the same " -"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." +":class:`Mock` is a flexible mock object intended to replace the use of stubs and test doubles throughout your code. Mocks are callable and create attributes as new mocks " +"when you access them [#]_. Accessing the same 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." msgstr "" +"La classe :class:`Mock` est un objet simulacre flexible destiné à remplacer l'utilisation d'objets bouchonnés 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 msgid "" -":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " -"pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't callable: :class:" -"`NonCallableMock` and :class:`NonCallableMagicMock`" +":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods pre-created and ready to use. There are also non-callable variants, useful when you are mocking " +"out objects that aren't callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" +"La classe :class:`MagicMock` est une sous-classe de :class:`Mock` avec toutes les méthodes magiques pré-créées et prêtes à utiliser. 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 msgid "" -"The :func:`patch` decorators makes it easy to temporarily replace classes in " -"a particular module with a :class:`Mock` object. By default :func:`patch` " -"will create a :class:`MagicMock` for you. You can specify an alternative " -"class of :class:`Mock` using the *new_callable* argument to :func:`patch`." +"The :func:`patch` decorators makes it easy to temporarily replace classes in a particular module with a :class:`Mock` object. By default :func:`patch` will create a :class:" +"`MagicMock` for you. You can specify an alternative class of :class:`Mock` using the *new_callable* argument to :func:`patch`." 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` va créer 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 -msgid "" -"Create a new :class:`Mock` object. :class:`Mock` takes several optional " -"arguments that specify the behaviour of the Mock object:" +msgid "Create a new :class:`Mock` object. :class:`Mock` takes several optional arguments that specify the behaviour of the Mock object:" msgstr "" #: ../Doc/library/unittest.mock.rst:209 msgid "" -"*spec*: This can be either a list of strings or an existing object (a class " -"or instance) that acts as the specification for the mock object. If you pass " -"in an object then a list of strings is formed by calling dir on the object " -"(excluding unsupported magic attributes and methods). Accessing any " -"attribute not in this list will raise an :exc:`AttributeError`." +"*spec*: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a " +"list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an :exc:" +"`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:215 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~instance." -"__class__` returns the class of the spec object. This allows mocks to pass :" -"func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) then :attr:`~instance.__class__` returns the class of the spec object. This allows mocks to pass :func:`isinstance` " +"tests." msgstr "" #: ../Doc/library/unittest.mock.rst:219 msgid "" -"*spec_set*: A stricter variant of *spec*. If used, attempting to *set* or " -"get an attribute on the mock that isn't on the object passed as *spec_set* " -"will raise an :exc:`AttributeError`." +"*spec_set*: A stricter variant of *spec*. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as *spec_set* will raise an :exc:" +"`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:223 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :" -"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " -"dynamically changing return values. The function is called with the same " -"arguments as the mock, and unless it returns :data:`DEFAULT`, the return " -"value of this function is used as the return value." +"*side_effect*: A function to be called whenever the Mock is called. See the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or dynamically changing return " +"values. The function is called with the same arguments as the mock, and unless it returns :data:`DEFAULT`, the return value of this function is used as the return value." msgstr "" #: ../Doc/library/unittest.mock.rst:229 -msgid "" -"Alternatively *side_effect* can be an exception class or instance. In this " -"case the exception will be raised when the mock is called." +msgid "Alternatively *side_effect* can be an exception class or instance. In this case the exception will be raised when the mock is called." msgstr "" #: ../Doc/library/unittest.mock.rst:232 -msgid "" -"If *side_effect* is an iterable then each call to the mock will return the " -"next value from the iterable." +msgid "If *side_effect* is an iterable then each call to the mock will return the next value from the iterable." msgstr "" #: ../Doc/library/unittest.mock.rst:235 @@ -251,46 +233,33 @@ msgid "A *side_effect* can be cleared by setting it to ``None``." msgstr "" #: ../Doc/library/unittest.mock.rst:237 -msgid "" -"*return_value*: The value returned when the mock is called. By default this " -"is a new Mock (created on first access). See the :attr:`return_value` " -"attribute." +msgid "*return_value*: The value returned when the mock is called. By default this is a new Mock (created on first access). See the :attr:`return_value` attribute." msgstr "" #: ../Doc/library/unittest.mock.rst:241 msgid "" -"*unsafe*: By default if any attribute starts with *assert* or *assret* will " -"raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to " -"these attributes." +"*unsafe*: By default if any attribute starts with *assert* or *assret* will raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these attributes." msgstr "" #: ../Doc/library/unittest.mock.rst:247 msgid "" -"*wraps*: Item for the mock object to wrap. If *wraps* is not ``None`` then " -"calling the Mock will pass the call through to the wrapped object (returning " -"the real result). Attribute access on the mock will return a Mock object " -"that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise an :exc:" -"`AttributeError`)." +"*wraps*: Item for the mock object to wrap. If *wraps* is not ``None`` then calling the Mock will pass the call through to the wrapped object (returning the real result). " +"Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist " +"will raise an :exc:`AttributeError`)." msgstr "" #: ../Doc/library/unittest.mock.rst:254 -msgid "" -"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." +msgid "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." msgstr "" #: ../Doc/library/unittest.mock.rst:257 -msgid "" -"*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." +msgid "*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." msgstr "" #: ../Doc/library/unittest.mock.rst:261 msgid "" -"Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See the :meth:" -"`configure_mock` method for details." +"Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. See the :meth:`configure_mock` method for " +"details." msgstr "" #: ../Doc/library/unittest.mock.rst:267 @@ -302,15 +271,11 @@ msgid "Assert that the mock was called exactly once." msgstr "" #: ../Doc/library/unittest.mock.rst:296 -msgid "" -"This method is a convenient way of asserting that calls are made in a " -"particular way:" +msgid "This method is a convenient way of asserting that calls are made in a particular way:" msgstr "" #: ../Doc/library/unittest.mock.rst:306 -msgid "" -"Assert that the mock was called exactly once and that that call was with the " -"specified arguments." +msgid "Assert that the mock was called exactly once and that that call was with the specified arguments." msgstr "" #: ../Doc/library/unittest.mock.rst:321 @@ -319,28 +284,20 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:323 msgid "" -"The assert passes if the mock has *ever* been called, unlike :meth:" -"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " -"the call is the most recent one, and in the case of :meth:" -"`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that only pass if the call is the most recent " +"one, and in the case of :meth:`assert_called_once_with` it must also be the only call." msgstr "" #: ../Doc/library/unittest.mock.rst:336 -msgid "" -"assert the mock has been called with the specified calls. The :attr:" -"`mock_calls` list is checked for the calls." +msgid "assert the mock has been called with the specified calls. The :attr:`mock_calls` list is checked for the calls." msgstr "" #: ../Doc/library/unittest.mock.rst:339 -msgid "" -"If *any_order* is false (the default) then the calls must be sequential. " -"There can be extra calls before or after the specified calls." +msgid "If *any_order* is false (the default) then the calls must be sequential. There can be extra calls before or after the specified calls." msgstr "" #: ../Doc/library/unittest.mock.rst:343 -msgid "" -"If *any_order* is true then the calls can be in any order, but they must all " -"appear in :attr:`mock_calls`." +msgid "If *any_order* is true then the calls can be in any order, but they must all appear in :attr:`mock_calls`." msgstr "" #: ../Doc/library/unittest.mock.rst:358 @@ -357,12 +314,9 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:386 msgid "" -"This can be useful where you want to make a series of assertions that reuse " -"the same object. Note that :meth:`reset_mock` *doesn't* clear the return " -"value, :attr:`side_effect` or any child attributes you have set using normal " -"assignment by default. In case you want to reset *return_value* or :attr:" -"`side_effect`, then pass the corresponding parameter as ``True``. Child " -"mocks and the return value mock (if any) are reset as well." +"This can be useful where you want to make a series of assertions that reuse the same object. Note that :meth:`reset_mock` *doesn't* clear the return value, :attr:" +"`side_effect` or any child attributes you have set using normal assignment by default. In case you want to reset *return_value* or :attr:`side_effect`, then pass the " +"corresponding parameter as ``True``. Child mocks and the return value mock (if any) are reset as well." msgstr "" #: ../Doc/library/unittest.mock.rst:394 @@ -370,9 +324,7 @@ msgid "*return_value*, and :attr:`side_effect` are keyword only argument." msgstr "" #: ../Doc/library/unittest.mock.rst:400 -msgid "" -"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." +msgid "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." msgstr "" #: ../Doc/library/unittest.mock.rst:404 @@ -381,9 +333,8 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:409 msgid "" -"Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" -"attr:`mock_calls` attributes of this one." +"Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the :attr:`method_calls` and :attr:`mock_calls` " +"attributes of this one." msgstr "" #: ../Doc/library/unittest.mock.rst:416 @@ -391,9 +342,7 @@ msgid "Set attributes on the mock through keyword arguments." msgstr "" #: ../Doc/library/unittest.mock.rst:418 -msgid "" -"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:" +msgid "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:" msgstr "" #: ../Doc/library/unittest.mock.rst:432 @@ -401,35 +350,25 @@ msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "" #: ../Doc/library/unittest.mock.rst:445 -msgid "" -":meth:`configure_mock` exists to make it easier to do configuration after " -"the mock has been created." +msgid ":meth:`configure_mock` exists to make it easier to do configuration after the mock has been created." msgstr "" #: ../Doc/library/unittest.mock.rst:451 -msgid "" -":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " -"results. For mocks with a *spec* this includes all the permitted attributes " -"for the mock." +msgid ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful results. For mocks with a *spec* this includes all the permitted attributes for the mock." msgstr "" #: ../Doc/library/unittest.mock.rst:455 -msgid "" -"See :data:`FILTER_DIR` for what this filtering does, and how to switch it " -"off." +msgid "See :data:`FILTER_DIR` for what this filtering does, and how to switch it off." msgstr "" #: ../Doc/library/unittest.mock.rst:461 msgid "" -"Create the child mocks for attributes and return value. By default child " -"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." +"Create the child mocks for attributes and return value. By default child 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." msgstr "" #: ../Doc/library/unittest.mock.rst:466 -msgid "" -"For non-callable mocks the callable variant will be used (rather than any " -"custom subclass)." +msgid "For non-callable mocks the callable variant will be used (rather than any custom subclass)." msgstr "" #: ../Doc/library/unittest.mock.rst:472 @@ -445,9 +384,7 @@ msgid "Set this to configure the value returned by calling the mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:503 -msgid "" -"The default return value is a mock object and you can configure it in the " -"normal way:" +msgid "The default return value is a mock object and you can configure it in the normal way:" msgstr "" #: ../Doc/library/unittest.mock.rst:512 @@ -455,32 +392,23 @@ msgid ":attr:`return_value` can also be set in the constructor:" msgstr "" #: ../Doc/library/unittest.mock.rst:523 -msgid "" -"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." +msgid "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." msgstr "" #: ../Doc/library/unittest.mock.rst:526 msgid "" -"If you pass in a function it will be called with same arguments as the mock " -"and unless the function returns the :data:`DEFAULT` singleton the call to " -"the mock will then return whatever the function returns. If the function " -"returns :data:`DEFAULT` then the mock will return its normal value (from " -"the :attr:`return_value`)." +"If you pass in a function it will be called with same arguments as the mock and unless the function returns the :data:`DEFAULT` singleton the call to the mock will then " +"return whatever the function returns. If the function returns :data:`DEFAULT` then the mock will return its normal value (from the :attr:`return_value`)." msgstr "" #: ../Doc/library/unittest.mock.rst:532 msgid "" -"If you pass in an iterable, it is used to retrieve an iterator which must " -"yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock (:data:" -"`DEFAULT` handling is identical to the function case)." +"If you pass in an iterable, it is used to retrieve an iterator which must yield a value on every call. This value can either be an exception instance to be raised, or a " +"value to be returned from the call to the mock (:data:`DEFAULT` handling is identical to the function case)." msgstr "" #: ../Doc/library/unittest.mock.rst:537 -msgid "" -"An example of a mock that raises an exception (to test exception handling of " -"an API):" +msgid "An example of a mock that raises an exception (to test exception handling of an API):" msgstr "" #: ../Doc/library/unittest.mock.rst:547 @@ -492,9 +420,7 @@ msgid "Using a callable:" msgstr "" #: ../Doc/library/unittest.mock.rst:564 -msgid "" -":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:" +msgid ":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:" msgstr "" #: ../Doc/library/unittest.mock.rst:574 @@ -503,132 +429,95 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:588 msgid "" -"This is either ``None`` (if the mock hasn't been called), or the arguments " -"that the mock was last called with. This will be in the form of a tuple: the " -"first member is any ordered arguments the mock was called with (or an empty " -"tuple) and the second member is any keyword arguments (or an empty " -"dictionary)." +"This is either ``None`` (if the mock hasn't been called), or the arguments that the mock was last called with. This will be in the form of a tuple: the first member is any " +"ordered arguments the mock was called with (or an empty tuple) and the second member is any keyword arguments (or an empty dictionary)." msgstr "" #: ../Doc/library/unittest.mock.rst:611 msgid "" -":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" -"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " -"are tuples, so they can be unpacked to get at the individual arguments and " -"make more complex assertions. See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These are tuples, so they " +"can be unpacked to get at the individual arguments and make more complex assertions. See :ref:`calls as tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:620 msgid "" -"This is a list of all the calls made to the mock object in sequence (so the " -"length of the list is the number of times it has been called). Before any " -"calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare with :attr:" -"`call_args_list`." +"This is a list of all the calls made to the mock object in sequence (so the length of the list is the number of times it has been called). Before any calls have been made it " +"is an empty list. The :data:`call` object can be used for conveniently constructing lists of calls to compare with :attr:`call_args_list`." msgstr "" #: ../Doc/library/unittest.mock.rst:636 msgid "" -"Members of :attr:`call_args_list` are :data:`call` objects. These can be " -"unpacked as tuples to get at the individual arguments. See :ref:`calls as " -"tuples `." +"Members of :attr:`call_args_list` are :data:`call` objects. These can be unpacked as tuples to get at the individual arguments. See :ref:`calls as tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:643 -msgid "" -"As well as tracking calls to themselves, mocks also track calls to methods " -"and attributes, and *their* methods and attributes:" +msgid "As well as tracking calls to themselves, mocks also track calls to methods and attributes, and *their* methods and attributes:" msgstr "" #: ../Doc/library/unittest.mock.rst:654 msgid "" -"Members of :attr:`method_calls` are :data:`call` objects. These can be " -"unpacked as tuples to get at the individual arguments. See :ref:`calls as " -"tuples `." +"Members of :attr:`method_calls` are :data:`call` objects. These can be unpacked as tuples to get at the individual arguments. See :ref:`calls as tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:661 -msgid "" -":attr:`mock_calls` records *all* calls to the mock object, its methods, " -"magic methods *and* return value mocks." +msgid ":attr:`mock_calls` records *all* calls to the mock object, its methods, magic methods *and* return value mocks." msgstr "" #: ../Doc/library/unittest.mock.rst:679 msgid "" -"Members of :attr:`mock_calls` are :data:`call` objects. These can be " -"unpacked as tuples to get at the individual arguments. See :ref:`calls as " -"tuples `." +"Members of :attr:`mock_calls` are :data:`call` objects. These can be unpacked as tuples to get at the individual arguments. See :ref:`calls as tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:685 -msgid "" -"The way :attr:`mock_calls` are recorded means that where nested calls are " -"made, the parameters of ancestor calls are not recorded and so will always " -"compare equal:" +msgid "The way :attr:`mock_calls` are recorded means that where nested calls are made, the parameters of ancestor calls are not recorded and so will always compare equal:" msgstr "" #: ../Doc/library/unittest.mock.rst:699 msgid "" -"Normally the :attr:`__class__` attribute of an object will return its type. " -"For a mock object with a :attr:`spec`, ``__class__`` returns the spec class " -"instead. This allows mock objects to pass :func:`isinstance` tests for the " -"object they are replacing / masquerading as:" +"Normally the :attr:`__class__` attribute of an object will return its type. For a mock object with a :attr:`spec`, ``__class__`` returns the spec class instead. This allows " +"mock objects to pass :func:`isinstance` tests for the object they are replacing / masquerading as:" msgstr "" #: ../Doc/library/unittest.mock.rst:708 -msgid "" -":attr:`__class__` is assignable to, this allows a mock to pass an :func:" -"`isinstance` check without forcing you to use a spec:" +msgid ":attr:`__class__` is assignable to, this allows a mock to pass an :func:`isinstance` check without forcing you to use a spec:" msgstr "" #: ../Doc/library/unittest.mock.rst:718 msgid "" -"A non-callable version of :class:`Mock`. The constructor parameters have the " -"same meaning of :class:`Mock`, with the exception of *return_value* and " -"*side_effect* which have no meaning on a non-callable mock." +"A non-callable version of :class:`Mock`. The constructor parameters have the same meaning of :class:`Mock`, with the exception of *return_value* and *side_effect* which have " +"no meaning on a non-callable mock." msgstr "" #: ../Doc/library/unittest.mock.rst:722 -msgid "" -"Mock objects that use a class or an instance as a :attr:`spec` or :attr:" -"`spec_set` are able to pass :func:`isinstance` tests:" +msgid "Mock objects that use a class or an instance as a :attr:`spec` or :attr:`spec_set` are able to pass :func:`isinstance` tests:" msgstr "" #: ../Doc/library/unittest.mock.rst:732 -msgid "" -"The :class:`Mock` classes have support for mocking magic methods. See :ref:" -"`magic methods ` for the full details." +msgid "The :class:`Mock` classes have support for mocking magic methods. See :ref:`magic methods ` for the full details." msgstr "" #: ../Doc/library/unittest.mock.rst:735 msgid "" -"The mock classes and the :func:`patch` decorators all take arbitrary keyword " -"arguments for configuration. For the :func:`patch` decorators the keywords " -"are passed to the constructor of the mock being created. The keyword " -"arguments are for configuring attributes of the mock:" +"The mock classes and the :func:`patch` decorators all take arbitrary keyword arguments for configuration. For the :func:`patch` decorators the keywords are passed to the " +"constructor of the mock being created. The keyword arguments are for configuring attributes of the mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:746 msgid "" -"The return value and side effect of child mocks can be set in the same way, " -"using dotted notation. As you can't use dotted names directly in a call you " -"have to create a dictionary and unpack it using ``**``:" +"The return value and side effect of child mocks can be set in the same way, using dotted notation. As you can't use dotted names directly in a call you have to create a " +"dictionary and unpack it using ``**``:" msgstr "" #: ../Doc/library/unittest.mock.rst:761 msgid "" -"A callable mock which was created with a *spec* (or a *spec_set*) will " -"introspect the specification object's signature when matching calls to the " -"mock. Therefore, it can match the actual call's arguments regardless of " -"whether they were passed positionally or by name::" +"A callable mock which was created with a *spec* (or a *spec_set*) will introspect the specification object's signature when matching calls to the mock. Therefore, it can " +"match the actual call's arguments regardless of whether they were passed positionally or by name::" msgstr "" #: ../Doc/library/unittest.mock.rst:774 msgid "" -"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." -"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." -"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " -"calls on the mock object." +"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock.assert_any_call`. When :ref:`auto-" +"speccing`, it will also apply to method calls on the mock object." msgstr "" #: ../Doc/library/unittest.mock.rst:779 @@ -637,22 +526,16 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:785 msgid "" -"A mock intended to be used as a property, or other descriptor, on a class. :" -"class:`PropertyMock` provides :meth:`__get__` and :meth:`__set__` methods so " -"you can specify a return value when it is fetched." +"A mock intended to be used as a property, or other descriptor, on a class. :class:`PropertyMock` provides :meth:`__get__` and :meth:`__set__` methods so you can specify a " +"return value when it is fetched." msgstr "" #: ../Doc/library/unittest.mock.rst:789 -msgid "" -"Fetching a :class:`PropertyMock` instance from an object calls the mock, " -"with no args. Setting it calls the mock with the value being set." +msgid "Fetching a :class:`PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set." msgstr "" #: ../Doc/library/unittest.mock.rst:810 -msgid "" -"Because of the way mock attributes are stored you can't directly attach a :" -"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " -"type object::" +msgid "Because of the way mock attributes are stored you can't directly attach a :class:`PropertyMock` to a mock object. Instead you can attach it to the mock type object::" msgstr "" #: ../Doc/library/unittest.mock.rst:823 @@ -661,65 +544,46 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:825 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:" -"`~Mock.return_value` attribute. The default return value is a new Mock " -"object; it is created the first time the return value is accessed (either " -"explicitly or by calling the Mock) - but it is stored and the same one " -"returned each time." +"Mock objects are callable. The call will return the value set as the :attr:`~Mock.return_value` attribute. The default return value is a new Mock object; it is created the " +"first time the return value is accessed (either explicitly or by calling the Mock) - but it is stored and the same one returned each time." msgstr "" #: ../Doc/library/unittest.mock.rst:831 -msgid "" -"Calls made to the object will be recorded in the attributes like :attr:" -"`~Mock.call_args` and :attr:`~Mock.call_args_list`." +msgid "Calls made to the object will be recorded in the attributes like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" #: ../Doc/library/unittest.mock.rst:834 -msgid "" -"If :attr:`~Mock.side_effect` is set then it will be called after the call " -"has been recorded, so if :attr:`side_effect` raises an exception the call is " -"still recorded." +msgid "If :attr:`~Mock.side_effect` is set then it will be called after the call has been recorded, so if :attr:`side_effect` raises an exception the call is still recorded." msgstr "" #: ../Doc/library/unittest.mock.rst:838 -msgid "" -"The simplest way to make a mock raise an exception when called is to make :" -"attr:`~Mock.side_effect` an exception class or instance:" +msgid "The simplest way to make a mock raise an exception when called is to make :attr:`~Mock.side_effect` an exception class or instance:" msgstr "" #: ../Doc/library/unittest.mock.rst:856 msgid "" -"If :attr:`side_effect` is a function then whatever that function returns is " -"what calls to the mock return. The :attr:`side_effect` function is called " -"with the same arguments as the mock. This allows you to vary the return " -"value of the call dynamically, based on the input:" +"If :attr:`side_effect` is a function then whatever that function returns is what calls to the mock return. The :attr:`side_effect` function is called with the same arguments " +"as the mock. This allows you to vary the return value of the call dynamically, based on the input:" msgstr "" #: ../Doc/library/unittest.mock.rst:872 msgid "" -"If you want the mock to still return the default return value (a new mock), " -"or any set return value, then there are two ways of doing this. Either " -"return :attr:`mock.return_value` from inside :attr:`side_effect`, or return :" -"data:`DEFAULT`:" +"If you want the mock to still return the default return value (a new mock), or any set return value, then there are two ways of doing this. Either return :attr:`mock." +"return_value` from inside :attr:`side_effect`, or return :data:`DEFAULT`:" msgstr "" #: ../Doc/library/unittest.mock.rst:891 -msgid "" -"To remove a :attr:`side_effect`, and return to the default behaviour, set " -"the :attr:`side_effect` to ``None``:" +msgid "To remove a :attr:`side_effect`, and return to the default behaviour, set the :attr:`side_effect` to ``None``:" msgstr "" #: ../Doc/library/unittest.mock.rst:905 msgid "" -"The :attr:`side_effect` can also be any iterable object. Repeated calls to " -"the mock will return values from the iterable (until the iterable is " -"exhausted and a :exc:`StopIteration` is raised):" +"The :attr:`side_effect` can also be any iterable object. Repeated calls to the mock will return values from the iterable (until the iterable is exhausted and a :exc:" +"`StopIteration` is raised):" msgstr "" #: ../Doc/library/unittest.mock.rst:921 -msgid "" -"If any members of the iterable are exceptions they will be raised instead of " -"returned::" +msgid "If any members of the iterable are exceptions they will be raised instead of returned::" msgstr "" #: ../Doc/library/unittest.mock.rst:939 @@ -727,23 +591,17 @@ msgid "Deleting Attributes" msgstr "" #: ../Doc/library/unittest.mock.rst:941 -msgid "" -"Mock objects create attributes on demand. This allows them to pretend to be " -"objects of any type." +msgid "Mock objects create attributes on demand. This allows them to pretend to be objects of any type." msgstr "" #: ../Doc/library/unittest.mock.rst:944 msgid "" -"You may want a mock object to return ``False`` to a :func:`hasattr` call, or " -"raise an :exc:`AttributeError` when an attribute is fetched. You can do this " -"by providing an object as a :attr:`spec` for a mock, but that isn't always " -"convenient." +"You may want a mock object to return ``False`` to a :func:`hasattr` call, or raise an :exc:`AttributeError` when an attribute is fetched. You can do this by providing an " +"object as a :attr:`spec` for a mock, but that isn't always convenient." msgstr "" #: ../Doc/library/unittest.mock.rst:948 -msgid "" -"You \"block\" attributes by deleting them. Once deleted, accessing an " -"attribute will raise an :exc:`AttributeError`." +msgid "You \"block\" attributes by deleting them. Once deleted, accessing an attribute will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:965 @@ -752,16 +610,12 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:967 msgid "" -"Since \"name\" is an argument to the :class:`Mock` constructor, if you want " -"your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to use :meth:`~Mock." -"configure_mock`::" +"Since \"name\" is an argument to the :class:`Mock` constructor, if you want your mock object to have a \"name\" attribute you can't just pass it in at creation time. There " +"are two alternatives. One option is to use :meth:`~Mock.configure_mock`::" msgstr "" #: ../Doc/library/unittest.mock.rst:977 -msgid "" -"A simpler option is to simply set the \"name\" attribute after mock " -"creation::" +msgid "A simpler option is to simply set the \"name\" attribute after mock creation::" msgstr "" #: ../Doc/library/unittest.mock.rst:984 @@ -770,36 +624,24 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:986 msgid "" -"When you attach a mock as an attribute of another mock (or as the return " -"value) it becomes a \"child\" of that mock. Calls to the child are recorded " -"in the :attr:`~Mock.method_calls` and :attr:`~Mock.mock_calls` attributes of " -"the parent. This is useful for configuring child mocks and then attaching " -"them to the parent, or for attaching mocks to a parent that records all " -"calls to the children and allows you to make assertions about the order of " -"calls between mocks:" +"When you attach a mock as an attribute of another mock (or as the return value) it becomes a \"child\" of that mock. Calls to the child are recorded in the :attr:`~Mock." +"method_calls` and :attr:`~Mock.mock_calls` attributes of the parent. This is useful for configuring child mocks and then attaching them to the parent, or for attaching mocks " +"to a parent that records all calls to the children and allows you to make assertions about the order of calls between mocks:" msgstr "" #: ../Doc/library/unittest.mock.rst:1004 -msgid "" -"The exception to this is if the mock has a name. This allows you to prevent " -"the \"parenting\" if for some reason you don't want it to happen." +msgid "The exception to this is if the mock has a name. This allows you to prevent the \"parenting\" if for some reason you don't want it to happen." msgstr "" #: ../Doc/library/unittest.mock.rst:1015 -msgid "" -"Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use the :meth:`~Mock." -"attach_mock` method:" +msgid "Mocks created for you by :func:`patch` are automatically given names. To attach mocks that have names to a parent you use the :meth:`~Mock.attach_mock` method:" msgstr "" #: ../Doc/library/unittest.mock.rst:1033 msgid "" -"The only exceptions are magic methods and attributes (those that have " -"leading and trailing double underscores). Mock doesn't create these but " -"instead raises an :exc:`AttributeError`. This is because the interpreter " -"will often implicitly request these methods, and gets *very* confused to get " -"a new Mock object when it expects a magic method. If you need magic method " -"support see :ref:`magic methods `." +"The only exceptions are magic methods and attributes (those that have leading and trailing double underscores). Mock doesn't create these but instead raises an :exc:" +"`AttributeError`. This is because the interpreter will often implicitly request these methods, and gets *very* confused to get a new Mock object when it expects a magic " +"method. If you need magic method support see :ref:`magic methods `." msgstr "" #: ../Doc/library/unittest.mock.rst:1042 @@ -808,10 +650,8 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1044 msgid "" -"The patch decorators are used for patching objects only within the scope of " -"the function they decorate. They automatically handle the unpatching for " -"you, even if exceptions are raised. All of these functions can also be used " -"in with statements or as class decorators." +"The patch decorators are used for patching objects only within the scope of the function they decorate. They automatically handle the unpatching for you, even if exceptions " +"are raised. All of these functions can also be used in with statements or as class decorators." msgstr "" #: ../Doc/library/unittest.mock.rst:1051 @@ -819,195 +659,135 @@ msgid "patch" msgstr "" #: ../Doc/library/unittest.mock.rst:1055 -msgid "" -":func:`patch` is straightforward to use. The key is to do the patching in " -"the right namespace. See the section `where to patch`_." +msgid ":func:`patch` is straightforward to use. The key is to do the patching in the right namespace. See the section `where to patch`_." msgstr "" #: ../Doc/library/unittest.mock.rst:1060 msgid "" -":func:`patch` acts as a function decorator, class decorator or a context " -"manager. Inside the body of the function or with statement, the *target* is " -"patched with a *new* object. When the function/with statement exits the " -"patch is undone." +":func:`patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the *target* is patched with a *new* " +"object. When the function/with statement exits the patch is undone." msgstr "" #: ../Doc/library/unittest.mock.rst:1065 msgid "" -"If *new* is omitted, then the target is replaced with a :class:`MagicMock`. " -"If :func:`patch` is used as a decorator and *new* is omitted, the created " -"mock is passed in as an extra argument to the decorated function. If :func:" -"`patch` is used as a context manager the created mock is returned by the " -"context manager." +"If *new* is omitted, then the target is replaced with a :class:`MagicMock`. If :func:`patch` is used as a decorator and *new* is omitted, the created mock is passed in as an " +"extra argument to the decorated function. If :func:`patch` is used as a context manager the created mock is returned by the context manager." msgstr "" #: ../Doc/library/unittest.mock.rst:1071 msgid "" -"*target* should be a string in the form ``'package.module.ClassName'``. The " -"*target* is imported and the specified object replaced with the *new* " -"object, so the *target* must be importable from the environment you are " -"calling :func:`patch` from. The target is imported when the decorated " -"function is executed, not at decoration time." +"*target* should be a string in the form ``'package.module.ClassName'``. The *target* is imported and the specified object replaced with the *new* object, so the *target* " +"must be importable from the environment you are calling :func:`patch` from. The target is imported when the decorated function is executed, not at decoration time." msgstr "" #: ../Doc/library/unittest.mock.rst:1077 -msgid "" -"The *spec* and *spec_set* keyword arguments are passed to the :class:" -"`MagicMock` if patch is creating one for you." +msgid "The *spec* and *spec_set* keyword arguments are passed to the :class:`MagicMock` if patch is creating one for you." msgstr "" #: ../Doc/library/unittest.mock.rst:1080 -msgid "" -"In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " -"patch to pass in the object being mocked as the spec/spec_set object." +msgid "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes patch to pass in the object being mocked as the spec/spec_set object." msgstr "" #: ../Doc/library/unittest.mock.rst:1083 -msgid "" -"*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By default :class:" -"`MagicMock` is used." +msgid "*new_callable* allows you to specify a different class, or callable object, that will be called to create the *new* object. By default :class:`MagicMock` is used." msgstr "" #: ../Doc/library/unittest.mock.rst:1087 msgid "" -"A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " -"then the mock will be created with a spec from the object being replaced. " -"All attributes of the mock will also have the spec of the corresponding " -"attribute of the object being replaced. Methods and functions being mocked " -"will have their arguments checked and will raise a :exc:`TypeError` if they " -"are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See the :" -"func:`create_autospec` function and :ref:`auto-speccing`." +"A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` then the mock will be created with a spec from the object being replaced. All attributes of the " +"mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise " +"a :exc:`TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. See " +"the :func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" #: ../Doc/library/unittest.mock.rst:1097 -msgid "" -"Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " -"arbitrary object as the spec instead of the one being replaced." +msgid "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an arbitrary object as the spec instead of the one being replaced." msgstr "" #: ../Doc/library/unittest.mock.rst:1100 msgid "" -"By default :func:`patch` will fail to replace attributes that don't exist. " -"If you pass in ``create=True``, and the attribute doesn't exist, patch will " -"create the attribute for you when the patched function is called, and delete " -"it again after the patched function has exited. This is useful for writing " -"tests against attributes that your production code creates at runtime. It is " -"off by default because it can be dangerous. With it switched on you can " -"write passing tests against APIs that don't actually exist!" +"By default :func:`patch` will fail to replace attributes that don't exist. If you pass in ``create=True``, and the attribute doesn't exist, patch will create the attribute " +"for you when the patched function is called, and delete it again after the patched function has exited. This is useful for writing tests against attributes that your " +"production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist!" msgstr "" #: ../Doc/library/unittest.mock.rst:1110 -msgid "" -"If you are patching builtins in a module then you don't need to pass " -"``create=True``, it will be added by default." +msgid "If you are patching builtins in a module then you don't need to pass ``create=True``, it will be added by default." msgstr "" #: ../Doc/library/unittest.mock.rst:1114 msgid "" -"Patch can be used as a :class:`TestCase` class decorator. It works by " -"decorating each test method in the class. This reduces the boilerplate code " -"when your test methods share a common patchings set. :func:`patch` finds " -"tests by looking for method names that start with ``patch.TEST_PREFIX``. By " -"default this is ``'test'``, which matches the way :mod:`unittest` finds " -"tests. You can specify an alternative prefix by setting ``patch." -"TEST_PREFIX``." +"Patch can be used as a :class:`TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods " +"share a common patchings set. :func:`patch` finds tests by looking for method names that start with ``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " +"way :mod:`unittest` finds tests. You can specify an alternative prefix by setting ``patch.TEST_PREFIX``." msgstr "" #: ../Doc/library/unittest.mock.rst:1121 msgid "" -"Patch can be used as a context manager, with the with statement. Here the " -"patching applies to the indented block after the with statement. If you use " -"\"as\" then the patched object will be bound to the name after the \"as\"; " -"very useful if :func:`patch` is creating a mock object for you." +"Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use \"as\" then the patched " +"object will be bound to the name after the \"as\"; very useful if :func:`patch` is creating a mock object for you." msgstr "" #: ../Doc/library/unittest.mock.rst:1126 -msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed to " -"the :class:`Mock` (or *new_callable*) on construction." +msgid ":func:`patch` takes arbitrary keyword arguments. These will be passed to the :class:`Mock` (or *new_callable*) on construction." msgstr "" #: ../Doc/library/unittest.mock.rst:1129 -msgid "" -"``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " -"available for alternate use-cases." +msgid "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are available for alternate use-cases." msgstr "" #: ../Doc/library/unittest.mock.rst:1132 -msgid "" -":func:`patch` as function decorator, creating the mock for you and passing " -"it into the decorated function:" +msgid ":func:`patch` as function decorator, creating the mock for you and passing it into the decorated function:" msgstr "" #: ../Doc/library/unittest.mock.rst:1142 msgid "" -"Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be the :attr:" -"`~Mock.return_value` of the mock that will be used." +"Patching a class replaces the class with a :class:`MagicMock` *instance*. If the class is instantiated in the code under test then it will be the :attr:`~Mock.return_value` " +"of the mock that will be used." msgstr "" #: ../Doc/library/unittest.mock.rst:1146 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock." -"side_effect` to return a new mock each time. Alternatively you can set the " -"*return_value* to be anything you want." +"If the class is instantiated multiple times you could use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively you can set the *return_value* to be " +"anything you want." msgstr "" #: ../Doc/library/unittest.mock.rst:1150 -msgid "" -"To configure return values on methods of *instances* on the patched class " -"you must do this on the :attr:`return_value`. For example:" +msgid "To configure return values on methods of *instances* on the patched class you must do this on the :attr:`return_value`. For example:" msgstr "" #: ../Doc/library/unittest.mock.rst:1164 -msgid "" -"If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " -"then the return value of the created mock will have the same spec." +msgid "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, then the return value of the created mock will have the same spec." msgstr "" #: ../Doc/library/unittest.mock.rst:1174 msgid "" -"The *new_callable* argument is useful where you want to use an alternative " -"class to the default :class:`MagicMock` for the created mock. For example, " -"if you wanted a :class:`NonCallableMock` to be used:" +"The *new_callable* argument is useful where you want to use an alternative class to the default :class:`MagicMock` for the created mock. For example, if you wanted a :class:" +"`NonCallableMock` to be used:" msgstr "" #: ../Doc/library/unittest.mock.rst:1187 -msgid "" -"Another use case might be to replace an object with an :class:`io.StringIO` " -"instance:" +msgid "Another use case might be to replace an object with an :class:`io.StringIO` instance:" msgstr "" #: ../Doc/library/unittest.mock.rst:1200 msgid "" -"When :func:`patch` is creating a mock for you, it is common that the first " -"thing you need to do is to configure the mock. Some of that configuration " -"can be done in the call to patch. Any arbitrary keywords you pass into the " -"call will be used to set attributes on the created mock:" +"When :func:`patch` is creating a mock for you, it is common that the first thing you need to do is to configure the mock. Some of that configuration can be done in the call " +"to patch. Any arbitrary keywords you pass into the call will be used to set attributes on the created mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:1212 msgid "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock." -"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " -"configured. These aren't syntactically valid to pass in directly as keyword " -"arguments, but a dictionary with these as keys can still be expanded into a :" -"func:`patch` call using ``**``:" +"As well as attributes on the created mock attributes, like the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks can also be configured. These aren't " +"syntactically valid to pass in directly as keyword arguments, but a dictionary with these as keys can still be expanded into a :func:`patch` call using ``**``:" msgstr "" #: ../Doc/library/unittest.mock.rst:1228 -msgid "" -"By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail with :exc:" -"`AttributeError`::" +msgid "By default, attempting to patch a function in a module (or a method or an attribute in a class) that does not exist will fail with :exc:`AttributeError`::" msgstr "" #: ../Doc/library/unittest.mock.rst:1240 -msgid "" -"but adding ``create=True`` in the call to :func:`patch` will make the " -"previous example work as expected::" +msgid "but adding ``create=True`` in the call to :func:`patch` will make the previous example work as expected::" msgstr "" #: ../Doc/library/unittest.mock.rst:1251 @@ -1015,44 +795,31 @@ msgid "patch.object" msgstr "" #: ../Doc/library/unittest.mock.rst:1255 -msgid "" -"patch the named member (*attribute*) on an object (*target*) with a mock " -"object." +msgid "patch the named member (*attribute*) on an object (*target*) with a mock object." msgstr "" #: ../Doc/library/unittest.mock.rst:1258 msgid "" -":func:`patch.object` can be used as a decorator, class decorator or a " -"context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" -"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " -"configuring the mock object it creates." +":func:`patch.object` can be used as a decorator, class decorator or a context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* and *new_callable* have the " +"same meaning as for :func:`patch`. Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments for configuring the mock object it creates." msgstr "" #: ../Doc/library/unittest.mock.rst:1264 -msgid "" -"When used as a class decorator :func:`patch.object` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +msgid "When used as a class decorator :func:`patch.object` honours ``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" #: ../Doc/library/unittest.mock.rst:1267 msgid "" -"You can either call :func:`patch.object` with three arguments or two " -"arguments. The three argument form takes the object to be patched, the " -"attribute name and the object to replace the attribute with." +"You can either call :func:`patch.object` with three arguments or two arguments. The three argument form takes the object to be patched, the attribute name and the object to " +"replace the attribute with." msgstr "" #: ../Doc/library/unittest.mock.rst:1271 -msgid "" -"When calling with the two argument form you omit the replacement object, and " -"a mock is created for you and passed in as an extra argument to the " -"decorated function:" +msgid "When calling with the two argument form you omit the replacement object, and a mock is created for you and passed in as an extra argument to the decorated function:" msgstr "" #: ../Doc/library/unittest.mock.rst:1282 -msgid "" -"*spec*, *create* and the other arguments to :func:`patch.object` have the " -"same meaning as they do for :func:`patch`." +msgid "*spec*, *create* and the other arguments to :func:`patch.object` have the same meaning as they do for :func:`patch`." msgstr "" #: ../Doc/library/unittest.mock.rst:1287 @@ -1060,69 +827,49 @@ msgid "patch.dict" msgstr "" #: ../Doc/library/unittest.mock.rst:1291 -msgid "" -"Patch a dictionary, or dictionary like object, and restore the dictionary to " -"its original state after the test." +msgid "Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test." msgstr "" #: ../Doc/library/unittest.mock.rst:1294 msgid "" -"*in_dict* can be a dictionary or a mapping like container. If it is a " -"mapping then it must at least support getting, setting and deleting items " -"plus iterating over keys." +"*in_dict* can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys." msgstr "" #: ../Doc/library/unittest.mock.rst:1298 -msgid "" -"*in_dict* can also be a string specifying the name of the dictionary, which " -"will then be fetched by importing it." +msgid "*in_dict* can also be a string specifying the name of the dictionary, which will then be fetched by importing it." msgstr "" #: ../Doc/library/unittest.mock.rst:1301 -msgid "" -"*values* can be a dictionary of values to set in the dictionary. *values* " -"can also be an iterable of ``(key, value)`` pairs." +msgid "*values* can be a dictionary of values to set in the dictionary. *values* can also be an iterable of ``(key, value)`` pairs." msgstr "" #: ../Doc/library/unittest.mock.rst:1304 -msgid "" -"If *clear* is true then the dictionary will be cleared before the new values " -"are set." +msgid "If *clear* is true then the dictionary will be cleared before the new values are set." msgstr "" #: ../Doc/library/unittest.mock.rst:1307 -msgid "" -":func:`patch.dict` can also be called with arbitrary keyword arguments to " -"set values in the dictionary." +msgid ":func:`patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary." msgstr "" #: ../Doc/library/unittest.mock.rst:1310 msgid "" -":func:`patch.dict` can be used as a context manager, decorator or class " -"decorator. When used as a class decorator :func:`patch.dict` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +":func:`patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator :func:`patch.dict` honours ``patch.TEST_PREFIX`` for " +"choosing which methods to wrap." msgstr "" #: ../Doc/library/unittest.mock.rst:1314 -msgid "" -":func:`patch.dict` can be used to add members to a dictionary, or simply let " -"a test change a dictionary, and ensure the dictionary is restored when the " -"test ends." +msgid ":func:`patch.dict` can be used to add members to a dictionary, or simply let a test change a dictionary, and ensure the dictionary is restored when the test ends." msgstr "" #: ../Doc/library/unittest.mock.rst:1331 -msgid "" -"Keywords can be used in the :func:`patch.dict` call to set values in the " -"dictionary:" +msgid "Keywords can be used in the :func:`patch.dict` call to set values in the dictionary:" msgstr "" #: ../Doc/library/unittest.mock.rst:1341 msgid "" -":func:`patch.dict` can be used with dictionary like objects that aren't " -"actually dictionaries. At the very minimum they must support item getting, " -"setting, deleting and either iteration or membership test. This corresponds " -"to the magic methods :meth:`__getitem__`, :meth:`__setitem__`, :meth:" -"`__delitem__` and either :meth:`__iter__` or :meth:`__contains__`." +":func:`patch.dict` can be used with dictionary like objects that aren't actually dictionaries. At the very minimum they must support item getting, setting, deleting and " +"either iteration or membership test. This corresponds to the magic methods :meth:`__getitem__`, :meth:`__setitem__`, :meth:`__delitem__` and either :meth:`__iter__` or :meth:" +"`__contains__`." msgstr "" #: ../Doc/library/unittest.mock.rst:1370 @@ -1131,53 +878,39 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1374 msgid "" -"Perform multiple patches in a single call. It takes the object to be patched " -"(either as an object or a string to fetch the object by importing) and " -"keyword arguments for the patches::" +"Perform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the " +"patches::" msgstr "" #: ../Doc/library/unittest.mock.rst:1381 msgid "" -"Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " -"create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned when :func:" -"`patch.multiple` is used as a context manager." +"Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, " +"and a dictionary is returned when :func:`patch.multiple` is used as a context manager." msgstr "" #: ../Doc/library/unittest.mock.rst:1386 msgid "" -":func:`patch.multiple` can be used as a decorator, class decorator or a " -"context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " -"*new_callable* have the same meaning as for :func:`patch`. These arguments " -"will be applied to *all* patches done by :func:`patch.multiple`." +":func:`patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and *new_callable* have the " +"same meaning as for :func:`patch`. These arguments will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" #: ../Doc/library/unittest.mock.rst:1391 -msgid "" -"When used as a class decorator :func:`patch.multiple` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +msgid "When used as a class decorator :func:`patch.multiple` honours ``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" #: ../Doc/library/unittest.mock.rst:1394 msgid "" -"If you want :func:`patch.multiple` to create mocks for you, then you can " -"use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " -"decorator then the created mocks are passed into the decorated function by " -"keyword." +"If you want :func:`patch.multiple` to create mocks for you, then you can use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a decorator then the created " +"mocks are passed into the decorated function by keyword." msgstr "" #: ../Doc/library/unittest.mock.rst:1408 msgid "" -":func:`patch.multiple` can be nested with other ``patch`` decorators, but " -"put arguments passed by keyword *after* any of the standard arguments " -"created by :func:`patch`:" +":func:`patch.multiple` can be nested with other ``patch`` decorators, but put arguments passed by keyword *after* any of the standard arguments created by :func:`patch`:" msgstr "" #: ../Doc/library/unittest.mock.rst:1420 -msgid "" -"If :func:`patch.multiple` is used as a context manager, the value returned " -"by the context manager is a dictionary where created mocks are keyed by " -"name::" +msgid "If :func:`patch.multiple` is used as a context manager, the value returned by the context manager is a dictionary where created mocks are keyed by name::" msgstr "" #: ../Doc/library/unittest.mock.rst:1434 @@ -1186,49 +919,36 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1436 msgid "" -"All the patchers have :meth:`start` and :meth:`stop` methods. These make it " -"simpler to do patching in ``setUp`` methods or where you want to do multiple " -"patches without nesting decorators or with statements." +"All the patchers have :meth:`start` and :meth:`stop` methods. These make it simpler to do patching in ``setUp`` methods or where you want to do multiple patches without " +"nesting decorators or with statements." msgstr "" #: ../Doc/library/unittest.mock.rst:1440 msgid "" -"To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " -"as normal and keep a reference to the returned ``patcher`` object. You can " -"then call :meth:`start` to put the patch in place and :meth:`stop` to undo " -"it." +"To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` as normal and keep a reference to the returned ``patcher`` object. You can then call :meth:`start` " +"to put the patch in place and :meth:`stop` to undo it." msgstr "" #: ../Doc/library/unittest.mock.rst:1444 -msgid "" -"If you are using :func:`patch` to create a mock for you then it will be " -"returned by the call to ``patcher.start``." +msgid "If you are using :func:`patch` to create a mock for you then it will be returned by the call to ``patcher.start``." msgstr "" #: ../Doc/library/unittest.mock.rst:1458 -msgid "" -"A typical use case for this might be for doing multiple patches in the " -"``setUp`` method of a :class:`TestCase`:" +msgid "A typical use case for this might be for doing multiple patches in the ``setUp`` method of a :class:`TestCase`:" msgstr "" #: ../Doc/library/unittest.mock.rst:1480 msgid "" -"If you use this technique you must ensure that the patching is \"undone\" by " -"calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier:" +"If you use this technique you must ensure that the patching is \"undone\" by calling ``stop``. This can be fiddlier than you might think, because if an exception is raised " +"in the ``setUp`` then ``tearDown`` is not called. :meth:`unittest.TestCase.addCleanup` makes this easier:" msgstr "" #: ../Doc/library/unittest.mock.rst:1495 -msgid "" -"As an added bonus you no longer need to keep a reference to the ``patcher`` " -"object." +msgid "As an added bonus you no longer need to keep a reference to the ``patcher`` object." msgstr "" #: ../Doc/library/unittest.mock.rst:1498 -msgid "" -"It is also possible to stop all patches which have been started by using :" -"func:`patch.stopall`." +msgid "It is also possible to stop all patches which have been started by using :func:`patch.stopall`." msgstr "" #: ../Doc/library/unittest.mock.rst:1503 @@ -1240,9 +960,7 @@ msgid "patch builtins" msgstr "" #: ../Doc/library/unittest.mock.rst:1510 -msgid "" -"You can patch any builtins within a module. The following example patches " -"builtin :func:`ord`:" +msgid "You can patch any builtins within a module. The following example patches builtin :func:`ord`:" msgstr "" #: ../Doc/library/unittest.mock.rst:1523 @@ -1251,17 +969,12 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1525 msgid "" -"All of the patchers can be used as class decorators. When used in this way " -"they wrap every test method on the class. The patchers recognise methods " -"that start with ``'test'`` as being test methods. This is the same way that " -"the :class:`unittest.TestLoader` finds test methods by default." +"All of the patchers can be used as class decorators. When used in this way they wrap every test method on the class. The patchers recognise methods that start with " +"``'test'`` as being test methods. This is the same way that the :class:`unittest.TestLoader` finds test methods by default." msgstr "" #: ../Doc/library/unittest.mock.rst:1530 -msgid "" -"It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting ``patch." -"TEST_PREFIX``:" +msgid "It is possible that you want to use a different prefix for your tests. You can inform the patchers of the different prefix by setting ``patch.TEST_PREFIX``:" msgstr "" #: ../Doc/library/unittest.mock.rst:1553 @@ -1269,9 +982,7 @@ msgid "Nesting Patch Decorators" msgstr "" #: ../Doc/library/unittest.mock.rst:1555 -msgid "" -"If you want to perform multiple patches then you can simply stack up the " -"decorators." +msgid "If you want to perform multiple patches then you can simply stack up the decorators." msgstr "" #: ../Doc/library/unittest.mock.rst:1558 @@ -1280,9 +991,8 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1574 msgid "" -"Note that the decorators are applied from the bottom upwards. This is the " -"standard way that Python applies decorators. The order of the created mocks " -"passed into your test function matches this order." +"Note that the decorators are applied from the bottom upwards. This is the standard way that Python applies decorators. The order of the created mocks passed into your test " +"function matches this order." msgstr "" #: ../Doc/library/unittest.mock.rst:1582 @@ -1291,49 +1001,37 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1584 msgid "" -":func:`patch` works by (temporarily) changing the object that a *name* " -"points to with another one. There can be many names pointing to any " -"individual object, so for patching to work you must ensure that you patch " -"the name used by the system under test." +":func:`patch` works by (temporarily) changing the object that a *name* points to with another one. There can be many names pointing to any individual object, so for patching " +"to work you must ensure that you patch the name used by the system under test." msgstr "" #: ../Doc/library/unittest.mock.rst:1589 msgid "" -"The basic principle is that you patch where an object is *looked up*, which " -"is not necessarily the same place as where it is defined. A couple of " -"examples will help to clarify this." +"The basic principle is that you patch where an object is *looked up*, which is not necessarily the same place as where it is defined. A couple of examples will help to " +"clarify this." msgstr "" #: ../Doc/library/unittest.mock.rst:1593 -msgid "" -"Imagine we have a project that we want to test with the following structure::" +msgid "Imagine we have a project that we want to test with the following structure::" msgstr "" #: ../Doc/library/unittest.mock.rst:1602 msgid "" -"Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " -"using :func:`patch`. The problem is that when we import module b, which we " -"will have to do then it imports ``SomeClass`` from module a. If we use :func:" -"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " -"module b already has a reference to the *real* ``SomeClass`` and it looks " -"like our patching had no effect." +"Now we want to test ``some_function`` but we want to mock out ``SomeClass`` using :func:`patch`. The problem is that when we import module b, which we will have to do then " +"it imports ``SomeClass`` from module a. If we use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; module b already has a reference to the " +"*real* ``SomeClass`` and it looks like our patching had no effect." msgstr "" #: ../Doc/library/unittest.mock.rst:1609 msgid "" -"The key is to patch out ``SomeClass`` where it is used (or where it is " -"looked up). In this case ``some_function`` will actually look up " -"``SomeClass`` in module b, where we have imported it. The patching should " -"look like::" +"The key is to patch out ``SomeClass`` where it is used (or where it is looked up). In this case ``some_function`` will actually look up ``SomeClass`` in module b, where we " +"have imported it. The patching should look like::" msgstr "" #: ../Doc/library/unittest.mock.rst:1615 msgid "" -"However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." -"SomeClass``. Both of these import forms are common. In this case the class " -"we want to patch is being looked up in the module and so we have to patch " -"``a.SomeClass`` instead::" +"However, consider the alternative scenario where instead of ``from a import SomeClass`` module b does ``import a`` and ``some_function`` uses ``a.SomeClass``. Both of these " +"import forms are common. In this case the class we want to patch is being looked up in the module and so we have to patch ``a.SomeClass`` instead::" msgstr "" #: ../Doc/library/unittest.mock.rst:1624 @@ -1342,11 +1040,9 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1626 msgid "" -"Both patch_ and patch.object_ correctly patch and restore descriptors: class " -"methods, static methods and properties. You should patch these on the " -"*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." +"Both patch_ and patch.object_ correctly patch and restore descriptors: class methods, static methods and properties. You should patch these on the *class* rather than an " +"instance. They also work with *some* objects that proxy attribute access, like the `django settings object `_." msgstr "" #: ../Doc/library/unittest.mock.rst:1634 @@ -1359,43 +1055,32 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1641 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known as " -"\"magic methods\". This allows mock objects to replace containers or other " -"objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known as \"magic methods\". This allows mock objects to replace containers or other objects that implement " +"Python protocols." msgstr "" #: ../Doc/library/unittest.mock.rst:1645 msgid "" -"Because magic methods are looked up differently from normal methods [#]_, " -"this support has been specially implemented. This means that only specific " -"magic methods are supported. The supported list includes *almost* all of " -"them. If there are any missing that you need please let us know." +"Because magic methods are looked up differently from normal methods [#]_, this support has been specially implemented. This means that only specific magic methods are " +"supported. The supported list includes *almost* all of them. If there are any missing that you need please let us know." msgstr "" #: ../Doc/library/unittest.mock.rst:1650 msgid "" -"You mock magic methods by setting the method you are interested in to a " -"function or a mock instance. If you are using a function then it *must* take " -"``self`` as the first argument [#]_." +"You mock magic methods by setting the method you are interested in to a function or a mock instance. If you are using a function then it *must* take ``self`` as the first " +"argument [#]_." msgstr "" #: ../Doc/library/unittest.mock.rst:1673 -msgid "" -"One use case for this is for mocking objects used as context managers in a :" -"keyword:`with` statement:" +msgid "One use case for this is for mocking objects used as context managers in a :keyword:`with` statement:" msgstr "" #: ../Doc/library/unittest.mock.rst:1685 -msgid "" -"Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " -"are recorded in :attr:`~Mock.mock_calls`." +msgid "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they are recorded in :attr:`~Mock.mock_calls`." msgstr "" #: ../Doc/library/unittest.mock.rst:1690 -msgid "" -"If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise an :exc:" -"`AttributeError`." +msgid "If you use the *spec* keyword argument to create a mock then attempting to set a magic method that isn't in the spec will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:1693 @@ -1415,16 +1100,11 @@ msgid "``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__floor__``, ``__trunc__`` et ``__ceil__``" #: ../Doc/library/unittest.mock.rst:1698 -msgid "" -"Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " -"``__ne__``" +msgid "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and ``__ne__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1700 -msgid "" -"Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " -"``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " -"``__missing__``" +msgid "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, ``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and ``__missing__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1703 @@ -1437,17 +1117,12 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1705 msgid "" -"The numeric methods (including right hand and in-place variants): " -"``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__div__``, " -"``__truediv__``, ``__floordiv__``, ``__mod__``, ``__divmod__``, " -"``__lshift__``, ``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and " -"``__pow__``" +"The numeric methods (including right hand and in-place variants): ``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__div__``, ``__truediv__``, ``__floordiv__``, " +"``__mod__``, ``__divmod__``, ``__lshift__``, ``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1709 -msgid "" -"Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " -"``__index__``" +msgid "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and ``__index__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1711 @@ -1455,15 +1130,11 @@ msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1712 -msgid "" -"Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " -"``__getnewargs__``, ``__getstate__`` and ``__setstate__``" +msgid "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, ``__getstate__`` and ``__setstate__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1716 -msgid "" -"The following methods exist but are *not* supported as they are either in " -"use by mock, can't be set dynamically, or can cause problems:" +msgid "The following methods exist but are *not* supported as they are either in use by mock, can't be set dynamically, or can cause problems:" msgstr "" #: ../Doc/library/unittest.mock.rst:1719 @@ -1471,8 +1142,7 @@ msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1720 -msgid "" -"``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" +msgid "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1725 @@ -1480,16 +1150,13 @@ msgid "Magic Mock" msgstr "" #: ../Doc/library/unittest.mock.rst:1727 -msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" -"`NonCallableMagicMock`." +msgid "There are two ``MagicMock`` variants: :class:`MagicMock` and :class:`NonCallableMagicMock`." msgstr "" #: ../Doc/library/unittest.mock.rst:1732 msgid "" -"``MagicMock`` is a subclass of :class:`Mock` with default implementations of " -"most of the magic methods. You can use ``MagicMock`` without having to " -"configure the magic methods yourself." +"``MagicMock`` is a subclass of :class:`Mock` with default implementations of most of the magic methods. You can use ``MagicMock`` without having to configure the magic " +"methods yourself." msgstr "" #: ../Doc/library/unittest.mock.rst:1736 @@ -1497,9 +1164,7 @@ msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "" #: ../Doc/library/unittest.mock.rst:1738 -msgid "" -"If you use the *spec* or *spec_set* arguments then *only* magic methods that " -"exist in the spec will be created." +msgid "If you use the *spec* or *spec_set* arguments then *only* magic methods that exist in the spec will be created." msgstr "" #: ../Doc/library/unittest.mock.rst:1744 @@ -1508,24 +1173,18 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1746 msgid "" -"The constructor parameters have the same meaning as for :class:`MagicMock`, " -"with the exception of *return_value* and *side_effect* which have no meaning " -"on a non-callable mock." +"The constructor parameters have the same meaning as for :class:`MagicMock`, with the exception of *return_value* and *side_effect* which have no meaning on a non-callable " +"mock." msgstr "" #: ../Doc/library/unittest.mock.rst:1750 -msgid "" -"The magic methods are setup with :class:`MagicMock` objects, so you can " -"configure them and use them in the usual way:" +msgid "The magic methods are setup with :class:`MagicMock` objects, so you can configure them and use them in the usual way:" msgstr "" #: ../Doc/library/unittest.mock.rst:1760 msgid "" -"By default many of the protocol methods are required to return objects of a " -"specific type. These methods are preconfigured with a default return value, " -"so that they can be used without you having to do anything if you aren't " -"interested in the return value. You can still *set* the return value " -"manually if you want to change the default." +"By default many of the protocol methods are required to return objects of a specific type. These methods are preconfigured with a default return value, so that they can be " +"used without you having to do anything if you aren't interested in the return value. You can still *set* the return value manually if you want to change the default." msgstr "" #: ../Doc/library/unittest.mock.rst:1766 @@ -1602,35 +1261,24 @@ msgstr "Par exemple :" #: ../Doc/library/unittest.mock.rst:1797 msgid "" -"The two equality methods, :meth:`__eq__` and :meth:`__ne__`, are special. " -"They do the default equality comparison on identity, using the :attr:`~Mock." -"side_effect` attribute, unless you change their return value to return " -"something else::" +"The two equality methods, :meth:`__eq__` and :meth:`__ne__`, are special. They do the default equality comparison on identity, using the :attr:`~Mock.side_effect` attribute, " +"unless you change their return value to return something else::" msgstr "" #: ../Doc/library/unittest.mock.rst:1811 -msgid "" -"The return value of :meth:`MagicMock.__iter__` can be any iterable object " -"and isn't required to be an iterator:" +msgid "The return value of :meth:`MagicMock.__iter__` can be any iterable object and isn't required to be an iterator:" msgstr "" #: ../Doc/library/unittest.mock.rst:1821 -msgid "" -"If the return value *is* an iterator, then iterating over it once will " -"consume it and subsequent iterations will result in an empty list:" +msgid "If the return value *is* an iterator, then iterating over it once will consume it and subsequent iterations will result in an empty list:" msgstr "" #: ../Doc/library/unittest.mock.rst:1830 -msgid "" -"``MagicMock`` has all of the supported magic methods configured except for " -"some of the obscure and obsolete ones. You can still set these up if you " -"want." +msgid "``MagicMock`` has all of the supported magic methods configured except for some of the obscure and obsolete ones. You can still set these up if you want." msgstr "" #: ../Doc/library/unittest.mock.rst:1833 -msgid "" -"Magic methods that are supported but not setup by default in ``MagicMock`` " -"are:" +msgid "Magic methods that are supported but not setup by default in ``MagicMock`` are:" msgstr "" #: ../Doc/library/unittest.mock.rst:1835 @@ -1654,9 +1302,7 @@ msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` et ``__missing__``" #: ../Doc/library/unittest.mock.rst:1840 -msgid "" -"``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " -"``__getstate__`` and ``__setstate__``" +msgid "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, ``__getstate__`` and ``__setstate__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1842 @@ -1665,15 +1311,12 @@ msgstr "``__getformat__`` et ``__setformat__``" #: ../Doc/library/unittest.mock.rst:1846 msgid "" -"Magic methods *should* be looked up on the class rather than the instance. " -"Different versions of Python are inconsistent about applying this rule. The " -"supported protocol methods should work with all supported versions of Python." +"Magic methods *should* be looked up on the class rather than the instance. Different versions of Python are inconsistent about applying this rule. The supported protocol " +"methods should work with all supported versions of Python." msgstr "" #: ../Doc/library/unittest.mock.rst:1850 -msgid "" -"The function is basically hooked up to the class, but each ``Mock`` instance " -"is kept isolated from the others." +msgid "The function is basically hooked up to the class, but each ``Mock`` instance is kept isolated from the others." msgstr "" #: ../Doc/library/unittest.mock.rst:1855 @@ -1685,36 +1328,27 @@ msgid "sentinel" msgstr "" #: ../Doc/library/unittest.mock.rst:1862 -msgid "" -"The ``sentinel`` object provides a convenient way of providing unique " -"objects for your tests." +msgid "The ``sentinel`` object provides a convenient way of providing unique objects for your tests." msgstr "" #: ../Doc/library/unittest.mock.rst:1865 msgid "" -"Attributes are created on demand when you access them by name. Accessing the " -"same attribute will always return the same object. The objects returned have " -"a sensible repr so that test failure messages are readable." +"Attributes are created on demand when you access them by name. Accessing the same attribute will always return the same object. The objects returned have a sensible repr so " +"that test failure messages are readable." msgstr "" #: ../Doc/library/unittest.mock.rst:1869 -msgid "" -"The ``sentinel`` attributes now preserve their identity when they are :mod:" -"`copied ` or :mod:`pickled `." +msgid "The ``sentinel`` attributes now preserve their identity when they are :mod:`copied ` or :mod:`pickled `." msgstr "" #: ../Doc/library/unittest.mock.rst:1873 msgid "" -"Sometimes when testing you need to test that a specific object is passed as " -"an argument to another method, or returned. It can be common to create named " -"sentinel objects to test this. :data:`sentinel` provides a convenient way of " -"creating and testing the identity of objects like this." +"Sometimes when testing you need to test that a specific object is passed as an argument to another method, or returned. It can be common to create named sentinel objects to " +"test this. :data:`sentinel` provides a convenient way of creating and testing the identity of objects like this." msgstr "" #: ../Doc/library/unittest.mock.rst:1878 -msgid "" -"In this example we monkey patch ``method`` to return ``sentinel." -"some_object``:" +msgid "In this example we monkey patch ``method`` to return ``sentinel.some_object``:" msgstr "" #: ../Doc/library/unittest.mock.rst:1890 @@ -1723,9 +1357,8 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1895 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." -"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " -"indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to indicate that the normal " +"return value should be used." msgstr "" #: ../Doc/library/unittest.mock.rst:1901 @@ -1734,57 +1367,41 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1905 msgid "" -":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." -"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " -"with :meth:`~Mock.assert_has_calls`." +":func:`call` is a helper object for making simpler assertions, for comparing with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` and :attr:" +"`~Mock.method_calls`. :func:`call` can also be used with :meth:`~Mock.assert_has_calls`." msgstr "" #: ../Doc/library/unittest.mock.rst:1918 -msgid "" -"For a call object that represents multiple calls, :meth:`call_list` returns " -"a list of all the intermediate calls as well as the final call." +msgid "For a call object that represents multiple calls, :meth:`call_list` returns a list of all the intermediate calls as well as the final call." msgstr "" #: ../Doc/library/unittest.mock.rst:1922 msgid "" -"``call_list`` is particularly useful for making assertions on \"chained calls" -"\". A chained call is multiple calls on a single line of code. This results " -"in multiple entries in :attr:`~Mock.mock_calls` on a mock. Manually " -"constructing the sequence of calls can be tedious." +"``call_list`` is particularly useful for making assertions on \"chained calls\". A chained call is multiple calls on a single line of code. This results in multiple entries " +"in :attr:`~Mock.mock_calls` on a mock. Manually constructing the sequence of calls can be tedious." msgstr "" #: ../Doc/library/unittest.mock.rst:1927 -msgid "" -":meth:`~call.call_list` can construct the sequence of calls from the same " -"chained call:" +msgid ":meth:`~call.call_list` can construct the sequence of calls from the same chained call:" msgstr "" #: ../Doc/library/unittest.mock.rst:1944 msgid "" -"A ``call`` object is either a tuple of (positional args, keyword args) or " -"(name, positional args, keyword args) depending on how it was constructed. " -"When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." -"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " -"to get at the individual arguments they contain." +"A ``call`` object is either a tuple of (positional args, keyword args) or (name, positional args, keyword args) depending on how it was constructed. When you construct them " +"yourself this isn't particularly interesting, but the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` and :attr:`Mock.mock_calls` " +"attributes can be introspected to get at the individual arguments they contain." msgstr "" #: ../Doc/library/unittest.mock.rst:1951 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." -"call_args_list` are two-tuples of (positional args, keyword args) whereas " -"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " -"construct yourself, are three-tuples of (name, positional args, keyword " -"args)." +"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword args) whereas the ``call`` objects in :attr:`Mock." +"mock_calls`, along with ones you construct yourself, are three-tuples of (name, positional args, keyword args)." msgstr "" #: ../Doc/library/unittest.mock.rst:1956 msgid "" -"You can use their \"tupleness\" to pull out the individual arguments for " -"more complex introspection and assertions. The positional arguments are a " -"tuple (an empty tuple if there are no positional arguments) and the keyword " -"arguments are a dictionary:" +"You can use their \"tupleness\" to pull out the individual arguments for more complex introspection and assertions. The positional arguments are a tuple (an empty tuple if " +"there are no positional arguments) and the keyword arguments are a dictionary:" msgstr "" #: ../Doc/library/unittest.mock.rst:1990 @@ -1792,41 +1409,29 @@ msgid "create_autospec" msgstr "" #: ../Doc/library/unittest.mock.rst:1994 -msgid "" -"Create a mock object using another object as a spec. Attributes on the mock " -"will use the corresponding attribute on the *spec* object as their spec." +msgid "Create a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the *spec* object as their spec." msgstr "" #: ../Doc/library/unittest.mock.rst:1998 -msgid "" -"Functions or methods being mocked will have their arguments checked to " -"ensure that they are called with the correct signature." +msgid "Functions or methods being mocked will have their arguments checked to ensure that they are called with the correct signature." msgstr "" #: ../Doc/library/unittest.mock.rst:2001 -msgid "" -"If *spec_set* is ``True`` then attempting to set attributes that don't exist " -"on the spec object will raise an :exc:`AttributeError`." +msgid "If *spec_set* is ``True`` then attempting to set attributes that don't exist on the spec object will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:2004 msgid "" -"If a class is used as a spec then the return value of the mock (the instance " -"of the class) will have the same spec. You can use a class as the spec for " -"an instance object by passing ``instance=True``. The returned mock will only " -"be callable if instances of the mock are callable." +"If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by " +"passing ``instance=True``. The returned mock will only be callable if instances of the mock are callable." msgstr "" #: ../Doc/library/unittest.mock.rst:2009 -msgid "" -":func:`create_autospec` also takes arbitrary keyword arguments that are " -"passed to the constructor of the created mock." +msgid ":func:`create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock." msgstr "" #: ../Doc/library/unittest.mock.rst:2012 -msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" -"`create_autospec` and the *autospec* argument to :func:`patch`." +msgid "See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" #: ../Doc/library/unittest.mock.rst:2017 @@ -1835,23 +1440,18 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2021 msgid "" -"Sometimes you may need to make assertions about *some* of the arguments in a " -"call to mock, but either not care about some of the arguments or want to " -"pull them individually out of :attr:`~Mock.call_args` and make more complex " -"assertions on them." +"Sometimes you may need to make assertions about *some* of the arguments in a call to mock, but either not care about some of the arguments or want to pull them individually " +"out of :attr:`~Mock.call_args` and make more complex assertions on them." msgstr "" #: ../Doc/library/unittest.mock.rst:2026 msgid "" -"To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with` will then succeed no matter what was passed in." +"To ignore certain arguments you can pass in objects that compare equal to *everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock.assert_called_once_with` " +"will then succeed no matter what was passed in." msgstr "" #: ../Doc/library/unittest.mock.rst:2035 -msgid "" -":data:`ANY` can also be used in comparisons with call lists like :attr:" -"`~Mock.mock_calls`:" +msgid ":data:`ANY` can also be used in comparisons with call lists like :attr:`~Mock.mock_calls`:" msgstr "" #: ../Doc/library/unittest.mock.rst:2048 @@ -1860,36 +1460,26 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2052 msgid "" -":data:`FILTER_DIR` is a module level variable that controls the way mock " -"objects respond to :func:`dir` (only for Python 2.6 or more recent). The " -"default is ``True``, which uses the filtering described below, to only show " -"useful members. If you dislike this filtering, or need to switch it off for " -"diagnostic purposes, then set ``mock.FILTER_DIR = False``." +":data:`FILTER_DIR` is a module level variable that controls the way mock objects respond to :func:`dir` (only for Python 2.6 or more recent). The default is ``True``, which " +"uses the filtering described below, to only show useful members. If you dislike this filtering, or need to switch it off for diagnostic purposes, then set ``mock.FILTER_DIR " +"= False``." msgstr "" #: ../Doc/library/unittest.mock.rst:2058 msgid "" -"With filtering on, ``dir(some_mock)`` shows only useful attributes and will " -"include any dynamically created attributes that wouldn't normally be shown. " -"If the mock was created with a *spec* (or *autospec* of course) then all the " -"attributes from the original are shown, even if they haven't been accessed " -"yet:" +"With filtering on, ``dir(some_mock)`` shows only useful attributes and will include any dynamically created attributes that wouldn't normally be shown. If the mock was " +"created with a *spec* (or *autospec* of course) then all the attributes from the original are shown, even if they haven't been accessed yet:" msgstr "" #: ../Doc/library/unittest.mock.rst:2079 msgid "" -"Many of the not-very-useful (private to :class:`Mock` rather than the thing " -"being mocked) underscore and double underscore prefixed attributes have been " -"filtered from the result of calling :func:`dir` on a :class:`Mock`. If you " -"dislike this behaviour you can switch it off by setting the module level " -"switch :data:`FILTER_DIR`:" +"Many of the not-very-useful (private to :class:`Mock` rather than the thing being mocked) underscore and double underscore prefixed attributes have been filtered from the " +"result of calling :func:`dir` on a :class:`Mock`. If you dislike this behaviour you can switch it off by setting the module level switch :data:`FILTER_DIR`:" msgstr "" #: ../Doc/library/unittest.mock.rst:2097 msgid "" -"Alternatively you can just use ``vars(my_mock)`` (instance members) and " -"``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " -"of :data:`mock.FILTER_DIR`." +"Alternatively you can just use ``vars(my_mock)`` (instance members) and ``dir(type(my_mock))`` (type members) to bypass the filtering irrespective of :data:`mock.FILTER_DIR`." msgstr "" #: ../Doc/library/unittest.mock.rst:2103 @@ -1897,36 +1487,27 @@ msgid "mock_open" msgstr "" #: ../Doc/library/unittest.mock.rst:2107 -msgid "" -"A helper function to create a mock to replace the use of :func:`open`. It " -"works for :func:`open` called directly or used as a context manager." +msgid "A helper function to create a mock to replace the use of :func:`open`. It works for :func:`open` called directly or used as a context manager." msgstr "" #: ../Doc/library/unittest.mock.rst:2110 msgid "" -"The *mock* argument is the mock object to configure. If ``None`` (the " -"default) then a :class:`MagicMock` will be created for you, with the API " -"limited to methods or attributes available on standard file handles." +"The *mock* argument is the mock object to configure. If ``None`` (the default) then a :class:`MagicMock` will be created for you, with the API limited to methods or " +"attributes available on standard file handles." msgstr "" #: ../Doc/library/unittest.mock.rst:2114 msgid "" -"*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase." -"readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to " -"return. Calls to those methods will take data from *read_data* until it is " -"depleted. The mock of these methods is pretty simplistic: every time the " -"*mock* is called, the *read_data* is rewound to the start. If you need more " -"control over the data that you are feeding to the tested code you will need " -"to customize this mock for yourself. When that is insufficient, one of the " -"in-memory filesystem packages on `PyPI `_ can offer a " -"realistic filesystem for testing." +"*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to return. Calls to those " +"methods will take data from *read_data* until it is depleted. The mock of these methods is pretty simplistic: every time the *mock* is called, the *read_data* is rewound to " +"the start. If you need more control over the data that you are feeding to the tested code you will need to customize this mock for yourself. When that is insufficient, one " +"of the in-memory filesystem packages on `PyPI `_ can offer a realistic filesystem for testing." msgstr "" #: ../Doc/library/unittest.mock.rst:2124 msgid "" -"Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " -"The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather " -"than returning it on each call." +"Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather than returning it on " +"each call." msgstr "" #: ../Doc/library/unittest.mock.rst:2129 @@ -1934,28 +1515,21 @@ msgid "*read_data* is now reset on each call to the *mock*." msgstr "" #: ../Doc/library/unittest.mock.rst:2132 -msgid "" -"Added :meth:`__iter__` to implementation so that iteration (such as in for " -"loops) correctly consumes *read_data*." +msgid "Added :meth:`__iter__` to implementation so that iteration (such as in for loops) correctly consumes *read_data*." msgstr "" #: ../Doc/library/unittest.mock.rst:2136 -msgid "" -"Using :func:`open` as a context manager is a great way to ensure your file " -"handles are closed properly and is becoming common::" +msgid "Using :func:`open` as a context manager is a great way to ensure your file handles are closed properly and is becoming common::" msgstr "" #: ../Doc/library/unittest.mock.rst:2142 msgid "" -"The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and has :meth:" -"`__enter__` and :meth:`__exit__` called)." +"The issue is that even if you mock out the call to :func:`open` it is the *returned object* that is used as a context manager (and has :meth:`__enter__` and :meth:`__exit__` " +"called)." msgstr "" #: ../Doc/library/unittest.mock.rst:2146 -msgid "" -"Mocking context managers with a :class:`MagicMock` is common enough and " -"fiddly enough that a helper function is useful." +msgid "Mocking context managers with a :class:`MagicMock` is common enough and fiddly enough that a helper function is useful." msgstr "" #: ../Doc/library/unittest.mock.rst:2163 @@ -1968,12 +1542,9 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2178 msgid "" -"Autospeccing is based on the existing :attr:`spec` feature of mock. It " -"limits the api of mocks to the api of an original object (the spec), but it " -"is recursive (implemented lazily) so that attributes of mocks only have the " -"same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise a :exc:" -"`TypeError` if they are called incorrectly." +"Autospeccing is based on the existing :attr:`spec` feature of mock. It limits the api of mocks to the api of an original object (the spec), but it is recursive (implemented " +"lazily) so that attributes of mocks only have the same api as the attributes of the spec. In addition mocked functions / methods have the same call signature as the original " +"so they raise a :exc:`TypeError` if they are called incorrectly." msgstr "" #: ../Doc/library/unittest.mock.rst:2185 @@ -1982,24 +1553,19 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2187 msgid "" -":class:`Mock` is a very powerful and flexible object, but it suffers from " -"two flaws when used to mock out objects from a system under test. One of " -"these flaws is specific to the :class:`Mock` api and the other is a more " -"general problem with using mock objects." +":class:`Mock` is a very powerful and flexible object, but it suffers from two flaws when used to mock out objects from a system under test. One of these flaws is specific to " +"the :class:`Mock` api and the other is a more general problem with using mock objects." msgstr "" #: ../Doc/library/unittest.mock.rst:2192 msgid "" -"First the problem specific to :class:`Mock`. :class:`Mock` has two assert " -"methods that are extremely handy: :meth:`~Mock.assert_called_with` and :meth:" -"`~Mock.assert_called_once_with`." +"First the problem specific to :class:`Mock`. :class:`Mock` has two assert methods that are extremely handy: :meth:`~Mock.assert_called_with` and :meth:`~Mock." +"assert_called_once_with`." msgstr "" #: ../Doc/library/unittest.mock.rst:2205 msgid "" -"Because mocks auto-create attributes on demand, and allow you to call them " -"with arbitrary arguments, if you misspell one of these assert methods then " -"your assertion is gone:" +"Because mocks auto-create attributes on demand, and allow you to call them with arbitrary arguments, if you misspell one of these assert methods then your assertion is gone:" msgstr "" #: ../Doc/library/unittest.mock.rst:2215 @@ -2008,42 +1574,31 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2217 msgid "" -"The second issue is more general to mocking. If you refactor some of your " -"code, rename members and so on, any tests for code that is still using the " -"*old api* but uses mocks instead of the real objects will still pass. This " -"means your tests can all pass even though your code is broken." +"The second issue is more general to mocking. If you refactor some of your code, rename members and so on, any tests for code that is still using the *old api* but uses mocks " +"instead of the real objects will still pass. This means your tests can all pass even though your code is broken." msgstr "" #: ../Doc/library/unittest.mock.rst:2222 msgid "" -"Note that this is another reason why you need integration tests as well as " -"unit tests. Testing everything in isolation is all fine and dandy, but if " -"you don't test how your units are \"wired together\" there is still lots of " -"room for bugs that tests might have caught." +"Note that this is another reason why you need integration tests as well as unit tests. Testing everything in isolation is all fine and dandy, but if you don't test how your " +"units are \"wired together\" there is still lots of room for bugs that tests might have caught." msgstr "" #: ../Doc/library/unittest.mock.rst:2227 msgid "" -":mod:`mock` already provides a feature to help with this, called speccing. " -"If you use a class or instance as the :attr:`spec` for a mock then you can " -"only access attributes on the mock that exist on the real class:" +":mod:`mock` already provides a feature to help with this, called speccing. If you use a class or instance as the :attr:`spec` for a mock then you can only access attributes " +"on the mock that exist on the real class:" msgstr "" #: ../Doc/library/unittest.mock.rst:2238 -msgid "" -"The spec only applies to the mock itself, so we still have the same issue " -"with any methods on the mock:" +msgid "The spec only applies to the mock itself, so we still have the same issue with any methods on the mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:2247 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" -"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " -"function to create a mock with a spec. If you use the ``autospec=True`` " -"argument to :func:`patch` then the object that is being replaced will be " -"used as the spec object. Because the speccing is done \"lazily\" (the spec " -"is created as attributes on the mock are accessed) you can use it with very " -"complex or deeply nested objects (like modules that import modules that " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` function to create a mock " +"with a spec. If you use the ``autospec=True`` argument to :func:`patch` then the object that is being replaced will be used as the spec object. Because the speccing is done " +"\"lazily\" (the spec is created as attributes on the mock are accessed) you can use it with very complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" @@ -2053,111 +1608,78 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2266 msgid "" -"You can see that :class:`request.Request` has a spec. :class:`request." -"Request` takes two arguments in the constructor (one of which is *self*). " -"Here's what happens if we try to call it incorrectly:" +"You can see that :class:`request.Request` has a spec. :class:`request.Request` takes two arguments in the constructor (one of which is *self*). Here's what happens if we try " +"to call it incorrectly:" msgstr "" #: ../Doc/library/unittest.mock.rst:2275 -msgid "" -"The spec also applies to instantiated classes (i.e. the return value of " -"specced mocks):" +msgid "The spec also applies to instantiated classes (i.e. the return value of specced mocks):" msgstr "" #: ../Doc/library/unittest.mock.rst:2282 msgid "" -":class:`Request` objects are not callable, so the return value of " -"instantiating our mocked out :class:`request.Request` is a non-callable " -"mock. With the spec in place any typos in our asserts will raise the correct " -"error:" +":class:`Request` objects are not callable, so the return value of instantiating our mocked out :class:`request.Request` is a non-callable mock. With the spec in place any " +"typos in our asserts will raise the correct error:" msgstr "" #: ../Doc/library/unittest.mock.rst:2294 -msgid "" -"In many cases you will just be able to add ``autospec=True`` to your " -"existing :func:`patch` calls and then be protected against bugs due to typos " -"and api changes." +msgid "In many cases you will just be able to add ``autospec=True`` to your existing :func:`patch` calls and then be protected against bugs due to typos and api changes." msgstr "" #: ../Doc/library/unittest.mock.rst:2298 -msgid "" -"As well as using *autospec* through :func:`patch` there is a :func:" -"`create_autospec` for creating autospecced mocks directly:" +msgid "As well as using *autospec* through :func:`patch` there is a :func:`create_autospec` for creating autospecced mocks directly:" msgstr "" #: ../Doc/library/unittest.mock.rst:2306 msgid "" -"This isn't without caveats and limitations however, which is why it is not " -"the default behaviour. In order to know what attributes are available on the " -"spec object, autospec has to introspect (access attributes) the spec. As you " -"traverse attributes on the mock a corresponding traversal of the original " -"object is happening under the hood. If any of your specced objects have " -"properties or descriptors that can trigger code execution then you may not " -"be able to use autospec. On the other hand it is much better to design your " -"objects so that introspection is safe [#]_." +"This isn't without caveats and limitations however, which is why it is not the default behaviour. In order to know what attributes are available on the spec object, autospec " +"has to introspect (access attributes) the spec. As you traverse attributes on the mock a corresponding traversal of the original object is happening under the hood. If any " +"of your specced objects have properties or descriptors that can trigger code execution then you may not be able to use autospec. On the other hand it is much better to " +"design your objects so that introspection is safe [#]_." msgstr "" #: ../Doc/library/unittest.mock.rst:2315 msgid "" -"A more serious problem is that it is common for instance attributes to be " -"created in the :meth:`__init__` method and not to exist on the class at all. " -"*autospec* can't know about any dynamically created attributes and restricts " -"the api to visible attributes." +"A more serious problem is that it is common for instance attributes to be created in the :meth:`__init__` method and not to exist on the class at all. *autospec* can't know " +"about any dynamically created attributes and restricts the api to visible attributes." msgstr "" #: ../Doc/library/unittest.mock.rst:2332 msgid "" -"There are a few different ways of resolving this problem. The easiest, but " -"not necessarily the least annoying, way is to simply set the required " -"attributes on the mock after creation. Just because *autospec* doesn't allow " -"you to fetch attributes that don't exist on the spec it doesn't prevent you " -"setting them:" +"There are a few different ways of resolving this problem. The easiest, but not necessarily the least annoying, way is to simply set the required attributes on the mock after " +"creation. Just because *autospec* doesn't allow you to fetch attributes that don't exist on the spec it doesn't prevent you setting them:" msgstr "" #: ../Doc/library/unittest.mock.rst:2343 msgid "" -"There is a more aggressive version of both *spec* and *autospec* that *does* " -"prevent you setting non-existent attributes. This is useful if you want to " -"ensure your code only *sets* valid attributes too, but obviously it prevents " -"this particular scenario:" +"There is a more aggressive version of both *spec* and *autospec* that *does* prevent you setting non-existent attributes. This is useful if you want to ensure your code only " +"*sets* valid attributes too, but obviously it prevents this particular scenario:" msgstr "" #: ../Doc/library/unittest.mock.rst:2356 msgid "" -"Probably the best way of solving the problem is to add class attributes as " -"default values for instance members initialised in :meth:`__init__`. Note " -"that if you are only setting default attributes in :meth:`__init__` then " -"providing them via class attributes (shared between instances of course) is " -"faster too. e.g." +"Probably the best way of solving the problem is to add class attributes as default values for instance members initialised in :meth:`__init__`. Note that if you are only " +"setting default attributes in :meth:`__init__` then providing them via class attributes (shared between instances of course) is faster too. e.g." msgstr "" #: ../Doc/library/unittest.mock.rst:2366 msgid "" -"This brings up another issue. It is relatively common to provide a default " -"value of ``None`` for members that will later be an object of a different " -"type. ``None`` would be useless as a spec because it wouldn't let you access " -"*any* attributes or methods on it. As ``None`` is *never* going to be useful " -"as a spec, and probably indicates a member that will normally of some other " -"type, autospec doesn't use a spec for members that are set to ``None``. " -"These will just be ordinary mocks (well - MagicMocks):" +"This brings up another issue. It is relatively common to provide a default value of ``None`` for members that will later be an object of a different type. ``None`` would be " +"useless as a spec because it wouldn't let you access *any* attributes or methods on it. As ``None`` is *never* going to be useful as a spec, and probably indicates a member " +"that will normally of some other type, autospec doesn't use a spec for members that are set to ``None``. These will just be ordinary mocks (well - MagicMocks):" msgstr "" #: ../Doc/library/unittest.mock.rst:2381 msgid "" -"If modifying your production classes to add defaults isn't to your liking " -"then there are more options. One of these is simply to use an instance as " -"the spec rather than the class. The other is to create a subclass of the " -"production class and add the defaults to the subclass without affecting the " -"production class. Both of these require you to use an alternative object as " -"the spec. Thankfully :func:`patch` supports this - you can simply pass the " -"alternative object as the *autospec* argument:" +"If modifying your production classes to add defaults isn't to your liking then there are more options. One of these is simply to use an instance as the spec rather than the " +"class. The other is to create a subclass of the production class and add the defaults to the subclass without affecting the production class. Both of these require you to " +"use an alternative object as the spec. Thankfully :func:`patch` supports this - you can simply pass the alternative object as the *autospec* argument:" msgstr "" #: ../Doc/library/unittest.mock.rst:2402 msgid "" -"This only applies to classes or already instantiated objects. Calling a " -"mocked class to create a mock instance *does not* create a real instance. It " -"is only attribute lookups - along with calls to :func:`dir` - that are done." +"This only applies to classes or already instantiated objects. Calling a mocked class to create a mock instance *does not* create a real instance. It is only attribute " +"lookups - along with calls to :func:`dir` - that are done." msgstr "" #: ../Doc/library/unittest.mock.rst:2407 @@ -2165,15 +1687,11 @@ msgid "Sealing mocks" msgstr "" #: ../Doc/library/unittest.mock.rst:2411 -msgid "" -"Seal will disable the automatic creation of mocks when accessing an " -"attribute of the mock being sealed or any of its attributes that are already " -"mocks recursively." +msgid "Seal will disable the automatic creation of mocks when accessing an attribute of the mock being sealed or any of its attributes that are already mocks recursively." msgstr "" #: ../Doc/library/unittest.mock.rst:2414 msgid "" -"If a mock instance with a name or a spec is assigned to an attribute it " -"won't be considered in the sealing chain. This allows one to prevent seal " -"from fixing part of the mock object." +"If a mock instance with a name or a spec is assigned to an attribute it won't be considered in the sealing chain. This allows one to prevent seal from fixing part of the " +"mock object." msgstr "" From 32056b362fedb828de326f9da66759e663bdf284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Sun, 31 Mar 2019 13:08:41 +0200 Subject: [PATCH 02/10] fix pour travis --- library/unittest.mock.po | 1448 ++++++++++++++++++++++++++------------ 1 file changed, 1008 insertions(+), 440 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 9d6a98bda..08aeb39a6 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -25,40 +25,61 @@ msgstr "**Code source :** :source:`Lib/unittest/mock.py`" #: ../Doc/library/unittest.mock.rst:17 msgid "" -":mod:`unittest.mock` is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have " -"been used." +":mod:`unittest.mock` is a library for testing in Python. It allows you to " +"replace parts of your system under test with mock objects and make " +"assertions about how they have been used." 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." +":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 msgid "" -":mod:`unittest.mock` provides a core :class:`Mock` class removing the need to create a host of stubs throughout your test suite. After performing an action, you can make " -"assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set needed attributes in the normal way." +":mod:`unittest.mock` provides a core :class:`Mock` class removing the need " +"to create a host of stubs throughout your test suite. After performing an " +"action, you can make assertions about which methods / attributes were used " +"and arguments they were called with. You can also specify return values and " +"set needed attributes in the normal way." 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." +":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 msgid "" -"Additionally, mock provides a :func:`patch` decorator that handles patching module and class level attributes within the scope of a test, along with :const:`sentinel` for " -"creating unique objects. See the `quick guide`_ for some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:`patch`." +"Additionally, mock provides a :func:`patch` decorator that handles patching " +"module and class level attributes within the scope of a test, along with :" +"const:`sentinel` for creating unique objects. See the `quick guide`_ for " +"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" +"`patch`." msgstr "" -"De plus, *mock* fournit un décorateur :func:`patch` qui est capable de *patcher* les module 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`." +"De plus, *mock* fournit un décorateur :func:`patch` qui est capable de " +"*patcher* les module 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 msgid "" -"Mock is very easy to use and is designed for use with :mod:`unittest`. Mock is based on the 'action -> assertion' pattern instead of 'record -> replay' used by many mocking " -"frameworks." +"Mock is very easy to use and is designed for use with :mod:`unittest`. Mock " +"is based on the 'action -> assertion' pattern instead of 'record -> replay' " +"used by many mocking frameworks." 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 frameworks d'objets simulacres." +"*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 frameworks d'objets " +"simulacres." #: ../Doc/library/unittest.mock.rst:37 -msgid "There is a backport of :mod:`unittest.mock` for earlier versions of Python, available as `mock on PyPI `_." -msgstr "Il y a un portage de :mod:`unittest.mock` pour les versions antérieures de Python, disponible `sur PyPI `_." +msgid "" +"There is a backport of :mod:`unittest.mock` for earlier versions of Python, " +"available as `mock on PyPI `_." +msgstr "" +"Il y a un portage de :mod:`unittest.mock` pour les versions antérieures de " +"Python, disponible `sur PyPI `_." #: ../Doc/library/unittest.mock.rst:42 msgid "Quick Guide" @@ -66,100 +87,156 @@ msgstr "Guide rapide" #: ../Doc/library/unittest.mock.rst:44 msgid "" -":class:`Mock` and :class:`MagicMock` objects create all attributes and methods as you access them and store details of how they have been used. You can configure them, to " -"specify return values or limit what attributes are available, and then make assertions about how they have been used:" +":class:`Mock` and :class:`MagicMock` objects create all attributes and " +"methods as you access them and store details of how they have been used. You " +"can configure them, to specify return values or limit what attributes are " +"available, and then make assertions about how they have been used:" 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 renvoie ou limiter les attributs utilisables, puis faire des assertions sur la façon dont ils ont été " -"utilisés ::" +"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 renvoie 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 -msgid ":attr:`side_effect` allows you to perform side effects, including raising an exception when a mock is called:" -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é ::" +msgid "" +":attr:`side_effect` allows you to perform side effects, including raising an " +"exception when a mock is called:" +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 msgid "" -"Mock has many other ways you can configure it and control its behaviour. For example the *spec* argument configures the mock to take its specification 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`." +"Mock has many other ways you can configure it and control its behaviour. For " +"example the *spec* argument configures the mock to take its specification " +"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`." msgstr "" -"*Mock* a beaucoup d'autres façons de configurer et de contrôler son comportement. 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 spécifiant lève une :exc:`AttributeError`." +"*Mock* a beaucoup d'autres façons de configurer et de contrôler son " +"comportement. 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 " +"spécifiant lève une :exc:`AttributeError`." #: ../Doc/library/unittest.mock.rst:81 msgid "" -"The :func:`patch` decorator / context manager makes it easy to mock classes or objects in a module under test. The object you specify will be replaced with a mock (or other " -"object) during the test and restored when the test ends:" +"The :func:`patch` decorator / context manager makes it easy to mock classes " +"or objects in a module under test. The object you specify will be replaced " +"with a mock (or other object) during the test and restored when the test " +"ends:" 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 ::" +"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 msgid "" -"When you nest patch decorators the mocks are passed in to the decorated function in the same order they applied (the normal *Python* order that decorators are applied). This " -"means from the bottom up, so in the example above the mock for ``module.ClassName1`` is passed in first." +"When you nest patch decorators the mocks are passed in to the decorated " +"function in the same order they applied (the normal *Python* order that " +"decorators are applied). This means from the bottom up, so in the example " +"above the mock for ``module.ClassName1`` is passed in first." 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." +"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 msgid "" -"With :func:`patch` it matters that you patch objects in the namespace where they are looked up. This is normally straightforward, but for a quick guide read :ref:`where to " -"patch `." +"With :func:`patch` it matters that you patch objects in the namespace where " +"they are looked up. This is normally straightforward, but for a quick guide " +"read :ref:`where to patch `." msgstr "" -"Avec :func:`patch`, il est important de patcher les objets dans l'espace de noms où ils sont recherchés. C'est normalement directe, mais pour un guide rapide, lisez :ref:`où " -"patcher `." +"Avec :func:`patch`, il est important de *patcher* les objets dans l'espace " +"de noms où ils sont recherchés. C'est normalement directe, mais pour un " +"guide rapide, lisez :ref:`où patcher `." #: ../Doc/library/unittest.mock.rst:109 -msgid "As well as a decorator :func:`patch` can be used as a context manager in a with statement:" -msgstr "Comme tout décorateur :func:`patch` peut être utilisé comme gestionnaire de contexte avec une instruction *with* ::" +msgid "" +"As well as a decorator :func:`patch` can be used as a context manager in a " +"with statement:" +msgstr "" +"Comme tout décorateur :func:`patch` peut être utilisé comme gestionnaire de " +"contexte avec une instruction *with* ::" #: ../Doc/library/unittest.mock.rst:119 -msgid "There is also :func:`patch.dict` for setting values in a dictionary just during a scope and restoring the dictionary to its original state when the test ends:" +msgid "" +"There is also :func:`patch.dict` for setting values in a dictionary just " +"during a scope and restoring the dictionary to its original state when the " +"test ends:" 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 ::" +"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 msgid "" -"Mock supports the mocking of Python :ref:`magic methods `. The easiest way of using magic methods is with the :class:`MagicMock` class. It allows you to do " -"things like:" +"Mock supports the mocking of Python :ref:`magic methods `. " +"The easiest way of using magic methods is with the :class:`MagicMock` class. " +"It allows you to do things like:" msgstr "" -"*Mock* supporte le remplacement des :ref:`méthodes magiques ` 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 ::" +"*Mock* supporte le remplacement des :ref:`méthodes magiques ` " +"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 msgid "" -"Mock allows you to assign functions (or other Mock instances) to magic methods and they will be called appropriately. The :class:`MagicMock` class is just a Mock variant " -"that has all of the magic methods pre-created for you (well, all the useful ones anyway)." +"Mock allows you to assign functions (or other Mock instances) to magic " +"methods and they will be called appropriately. The :class:`MagicMock` class " +"is just a Mock variant that has all of the magic methods pre-created for you " +"(well, all the useful ones anyway)." 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)." +"*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 -msgid "The following is an example of using magic methods with the ordinary Mock class:" -msgstr "L'exemple suivant est un exemple de création de méthodes magiques avec la classe *Mock* ordinaire ::" +msgid "" +"The following is an example of using magic methods with the ordinary Mock " +"class:" +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 msgid "" -"For ensuring that the mock objects in your tests have the same api as the objects they are replacing, you can use :ref:`auto-speccing `. Auto-speccing can be " -"done through the *autospec* argument to patch, or the :func:`create_autospec` function. Auto-speccing creates mock objects that have the same attributes and methods as the " -"objects they are replacing, and any functions and methods (including constructors) have the same call signature as the real object." -msgstr "" -"Pour assurer que les objets simulacres dans vos tests ont la même API que les objets qu'ils remplacent. Utiliser :ref:`l'auto-spécification `. L'auto-" -"spécification peut se faire via l'argument *autospec* de patch, ou 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." +"For ensuring that the mock objects in your tests have the same api as the " +"objects they are replacing, you can use :ref:`auto-speccing `. Auto-speccing can be done through the *autospec* argument to " +"patch, or the :func:`create_autospec` function. Auto-speccing creates mock " +"objects that have the same attributes and methods as the objects they are " +"replacing, and any functions and methods (including constructors) have the " +"same call signature as the real object." +msgstr "" +"Pour assurer que les objets simulacres dans vos tests ont la même API que " +"les objets qu'ils remplacent. Utiliser :ref:`l'auto-spécification `. L'auto-spécification peut se faire via l'argument *autospec* de " +"patch, ou 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 -msgid "This ensures that your mocks will fail in the same way as your production code if they are used incorrectly:" -msgstr "Ceci garantit que vos objets simulacres échoueront de la même manière que votre code de production si ils sont utilisées incorrectement ::" +msgid "" +"This ensures that your mocks will fail in the same way as your production " +"code if they are used incorrectly:" +msgstr "" +"Ceci garantit que vos objets simulacres échoueront de la même manière que " +"votre code de production si ils sont utilisées incorrectement ::" #: ../Doc/library/unittest.mock.rst:177 msgid "" -":func:`create_autospec` can also be used on classes, where it copies the signature of the ``__init__`` method, and on callable objects where it copies the signature of the " -"``__call__`` method." +":func:`create_autospec` can also be used on classes, where it copies the " +"signature of the ``__init__`` method, and on callable objects where it " +"copies the signature of the ``__call__`` method." msgstr "" -"La fonction :func:`create_autospec` peut aussi être utilisé 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__``." +"La fonction :func:`create_autospec` peut aussi être utilisé 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 msgid "The Mock Class" @@ -167,65 +244,92 @@ msgstr "La classe *Mock*" #: ../Doc/library/unittest.mock.rst:187 msgid "" -":class:`Mock` is a flexible mock object intended to replace the use of stubs and test doubles throughout your code. Mocks are callable and create attributes as new mocks " -"when you access them [#]_. Accessing the same 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." +":class:`Mock` is a flexible mock object intended to replace the use of stubs " +"and test doubles throughout your code. Mocks are callable and create " +"attributes as new mocks when you access them [#]_. Accessing the same " +"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." msgstr "" -"La classe :class:`Mock` est un objet simulacre flexible destiné à remplacer l'utilisation d'objets bouchonnés 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." +"La classe :class:`Mock` est un objet simulacre flexible destiné à remplacer " +"l'utilisation d'objets bouchonnés 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 msgid "" -":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods pre-created and ready to use. There are also non-callable variants, useful when you are mocking " -"out objects that aren't callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" +":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " +"pre-created and ready to use. There are also non-callable variants, useful " +"when you are mocking out objects that aren't callable: :class:" +"`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" -"La classe :class:`MagicMock` est une sous-classe de :class:`Mock` avec toutes les méthodes magiques pré-créées et prêtes à utiliser. Il existe également des variantes non " -"appelables, utiles lorsque l'on simule des objets qui ne sont pas appelables : :class:`NonCallableMock` et :class:`NonCallableMagicMock`" +"La classe :class:`MagicMock` est une sous-classe de :class:`Mock` avec " +"toutes les méthodes magiques pré-créées et prêtes à utiliser. 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 msgid "" -"The :func:`patch` decorators makes it easy to temporarily replace classes in a particular module with a :class:`Mock` object. By default :func:`patch` will create a :class:" -"`MagicMock` for you. You can specify an alternative class of :class:`Mock` using the *new_callable* argument to :func:`patch`." +"The :func:`patch` decorators makes it easy to temporarily replace classes in " +"a particular module with a :class:`Mock` object. By default :func:`patch` " +"will create a :class:`MagicMock` for you. You can specify an alternative " +"class of :class:`Mock` using the *new_callable* argument to :func:`patch`." 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` va créer un :class:`MagicMock`. " -"On peut spécifier une classe alternative de :class:`Mock` en utilisant le paramètre *new_callable* de :func:`patch`." +"Le décorateur :func:`patch` facilite le remplacement temporaire de classes " +"d'un module avec un objet :class:`Mock`. Par défaut :func:`patch` va créer " +"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 -msgid "Create a new :class:`Mock` object. :class:`Mock` takes several optional arguments that specify the behaviour of the Mock object:" +msgid "" +"Create a new :class:`Mock` object. :class:`Mock` takes several optional " +"arguments that specify the behaviour of the Mock object:" msgstr "" #: ../Doc/library/unittest.mock.rst:209 msgid "" -"*spec*: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a " -"list of strings is formed by calling dir on the object (excluding unsupported magic attributes and methods). Accessing any attribute not in this list will raise an :exc:" -"`AttributeError`." +"*spec*: This can be either a list of strings or an existing object (a class " +"or instance) that acts as the specification for the mock object. If you pass " +"in an object then a list of strings is formed by calling dir on the object " +"(excluding unsupported magic attributes and methods). Accessing any " +"attribute not in this list will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:215 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~instance.__class__` returns the class of the spec object. This allows mocks to pass :func:`isinstance` " -"tests." +"If *spec* is an object (rather than a list of strings) then :attr:`~instance." +"__class__` returns the class of the spec object. This allows mocks to pass :" +"func:`isinstance` tests." msgstr "" #: ../Doc/library/unittest.mock.rst:219 msgid "" -"*spec_set*: A stricter variant of *spec*. If used, attempting to *set* or get an attribute on the mock that isn't on the object passed as *spec_set* will raise an :exc:" -"`AttributeError`." +"*spec_set*: A stricter variant of *spec*. If used, attempting to *set* or " +"get an attribute on the mock that isn't on the object passed as *spec_set* " +"will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:223 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or dynamically changing return " -"values. The function is called with the same arguments as the mock, and unless it returns :data:`DEFAULT`, the return value of this function is used as the return value." +"*side_effect*: A function to be called whenever the Mock is called. See the :" +"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"dynamically changing return values. The function is called with the same " +"arguments as the mock, and unless it returns :data:`DEFAULT`, the return " +"value of this function is used as the return value." msgstr "" #: ../Doc/library/unittest.mock.rst:229 -msgid "Alternatively *side_effect* can be an exception class or instance. In this case the exception will be raised when the mock is called." +msgid "" +"Alternatively *side_effect* can be an exception class or instance. In this " +"case the exception will be raised when the mock is called." msgstr "" #: ../Doc/library/unittest.mock.rst:232 -msgid "If *side_effect* is an iterable then each call to the mock will return the next value from the iterable." +msgid "" +"If *side_effect* is an iterable then each call to the mock will return the " +"next value from the iterable." msgstr "" #: ../Doc/library/unittest.mock.rst:235 @@ -233,33 +337,46 @@ msgid "A *side_effect* can be cleared by setting it to ``None``." msgstr "" #: ../Doc/library/unittest.mock.rst:237 -msgid "*return_value*: The value returned when the mock is called. By default this is a new Mock (created on first access). See the :attr:`return_value` attribute." +msgid "" +"*return_value*: The value returned when the mock is called. By default this " +"is a new Mock (created on first access). See the :attr:`return_value` " +"attribute." msgstr "" #: ../Doc/library/unittest.mock.rst:241 msgid "" -"*unsafe*: By default if any attribute starts with *assert* or *assret* will raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these attributes." +"*unsafe*: By default if any attribute starts with *assert* or *assret* will " +"raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to " +"these attributes." msgstr "" #: ../Doc/library/unittest.mock.rst:247 msgid "" -"*wraps*: Item for the mock object to wrap. If *wraps* is not ``None`` then calling the Mock will pass the call through to the wrapped object (returning the real result). " -"Attribute access on the mock will return a Mock object that wraps the corresponding attribute of the wrapped object (so attempting to access an attribute that doesn't exist " -"will raise an :exc:`AttributeError`)." +"*wraps*: Item for the mock object to wrap. If *wraps* is not ``None`` then " +"calling the Mock will pass the call through to the wrapped object (returning " +"the real result). Attribute access on the mock will return a Mock object " +"that wraps the corresponding attribute of the wrapped object (so attempting " +"to access an attribute that doesn't exist will raise an :exc:" +"`AttributeError`)." msgstr "" #: ../Doc/library/unittest.mock.rst:254 -msgid "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." +msgid "" +"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." msgstr "" #: ../Doc/library/unittest.mock.rst:257 -msgid "*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." +msgid "" +"*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." msgstr "" #: ../Doc/library/unittest.mock.rst:261 msgid "" -"Mocks can also be called with arbitrary keyword arguments. These will be used to set attributes on the mock after it is created. See the :meth:`configure_mock` method for " -"details." +"Mocks can also be called with arbitrary keyword arguments. These will be " +"used to set attributes on the mock after it is created. See the :meth:" +"`configure_mock` method for details." msgstr "" #: ../Doc/library/unittest.mock.rst:267 @@ -271,11 +388,15 @@ msgid "Assert that the mock was called exactly once." msgstr "" #: ../Doc/library/unittest.mock.rst:296 -msgid "This method is a convenient way of asserting that calls are made in a particular way:" +msgid "" +"This method is a convenient way of asserting that calls are made in a " +"particular way:" msgstr "" #: ../Doc/library/unittest.mock.rst:306 -msgid "Assert that the mock was called exactly once and that that call was with the specified arguments." +msgid "" +"Assert that the mock was called exactly once and that that call was with the " +"specified arguments." msgstr "" #: ../Doc/library/unittest.mock.rst:321 @@ -284,20 +405,28 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:323 msgid "" -"The assert passes if the mock has *ever* been called, unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that only pass if the call is the most recent " -"one, and in the case of :meth:`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, unlike :meth:" +"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " +"the call is the most recent one, and in the case of :meth:" +"`assert_called_once_with` it must also be the only call." msgstr "" #: ../Doc/library/unittest.mock.rst:336 -msgid "assert the mock has been called with the specified calls. The :attr:`mock_calls` list is checked for the calls." +msgid "" +"assert the mock has been called with the specified calls. The :attr:" +"`mock_calls` list is checked for the calls." msgstr "" #: ../Doc/library/unittest.mock.rst:339 -msgid "If *any_order* is false (the default) then the calls must be sequential. There can be extra calls before or after the specified calls." +msgid "" +"If *any_order* is false (the default) then the calls must be sequential. " +"There can be extra calls before or after the specified calls." msgstr "" #: ../Doc/library/unittest.mock.rst:343 -msgid "If *any_order* is true then the calls can be in any order, but they must all appear in :attr:`mock_calls`." +msgid "" +"If *any_order* is true then the calls can be in any order, but they must all " +"appear in :attr:`mock_calls`." msgstr "" #: ../Doc/library/unittest.mock.rst:358 @@ -314,9 +443,12 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:386 msgid "" -"This can be useful where you want to make a series of assertions that reuse the same object. Note that :meth:`reset_mock` *doesn't* clear the return value, :attr:" -"`side_effect` or any child attributes you have set using normal assignment by default. In case you want to reset *return_value* or :attr:`side_effect`, then pass the " -"corresponding parameter as ``True``. Child mocks and the return value mock (if any) are reset as well." +"This can be useful where you want to make a series of assertions that reuse " +"the same object. Note that :meth:`reset_mock` *doesn't* clear the return " +"value, :attr:`side_effect` or any child attributes you have set using normal " +"assignment by default. In case you want to reset *return_value* or :attr:" +"`side_effect`, then pass the corresponding parameter as ``True``. Child " +"mocks and the return value mock (if any) are reset as well." msgstr "" #: ../Doc/library/unittest.mock.rst:394 @@ -324,7 +456,9 @@ msgid "*return_value*, and :attr:`side_effect` are keyword only argument." msgstr "" #: ../Doc/library/unittest.mock.rst:400 -msgid "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." +msgid "" +"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." msgstr "" #: ../Doc/library/unittest.mock.rst:404 @@ -333,8 +467,9 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:409 msgid "" -"Attach a mock as an attribute of this one, replacing its name and parent. Calls to the attached mock will be recorded in the :attr:`method_calls` and :attr:`mock_calls` " -"attributes of this one." +"Attach a mock as an attribute of this one, replacing its name and parent. " +"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" +"attr:`mock_calls` attributes of this one." msgstr "" #: ../Doc/library/unittest.mock.rst:416 @@ -342,7 +477,9 @@ msgid "Set attributes on the mock through keyword arguments." msgstr "" #: ../Doc/library/unittest.mock.rst:418 -msgid "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:" +msgid "" +"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:" msgstr "" #: ../Doc/library/unittest.mock.rst:432 @@ -350,25 +487,35 @@ msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "" #: ../Doc/library/unittest.mock.rst:445 -msgid ":meth:`configure_mock` exists to make it easier to do configuration after the mock has been created." +msgid "" +":meth:`configure_mock` exists to make it easier to do configuration after " +"the mock has been created." msgstr "" #: ../Doc/library/unittest.mock.rst:451 -msgid ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful results. For mocks with a *spec* this includes all the permitted attributes for the mock." +msgid "" +":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " +"results. For mocks with a *spec* this includes all the permitted attributes " +"for the mock." msgstr "" #: ../Doc/library/unittest.mock.rst:455 -msgid "See :data:`FILTER_DIR` for what this filtering does, and how to switch it off." +msgid "" +"See :data:`FILTER_DIR` for what this filtering does, and how to switch it " +"off." msgstr "" #: ../Doc/library/unittest.mock.rst:461 msgid "" -"Create the child mocks for attributes and return value. By default child 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." +"Create the child mocks for attributes and return value. By default child " +"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." msgstr "" #: ../Doc/library/unittest.mock.rst:466 -msgid "For non-callable mocks the callable variant will be used (rather than any custom subclass)." +msgid "" +"For non-callable mocks the callable variant will be used (rather than any " +"custom subclass)." msgstr "" #: ../Doc/library/unittest.mock.rst:472 @@ -384,7 +531,9 @@ msgid "Set this to configure the value returned by calling the mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:503 -msgid "The default return value is a mock object and you can configure it in the normal way:" +msgid "" +"The default return value is a mock object and you can configure it in the " +"normal way:" msgstr "" #: ../Doc/library/unittest.mock.rst:512 @@ -392,23 +541,32 @@ msgid ":attr:`return_value` can also be set in the constructor:" msgstr "" #: ../Doc/library/unittest.mock.rst:523 -msgid "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." +msgid "" +"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." msgstr "" #: ../Doc/library/unittest.mock.rst:526 msgid "" -"If you pass in a function it will be called with same arguments as the mock and unless the function returns the :data:`DEFAULT` singleton the call to the mock will then " -"return whatever the function returns. If the function returns :data:`DEFAULT` then the mock will return its normal value (from the :attr:`return_value`)." +"If you pass in a function it will be called with same arguments as the mock " +"and unless the function returns the :data:`DEFAULT` singleton the call to " +"the mock will then return whatever the function returns. If the function " +"returns :data:`DEFAULT` then the mock will return its normal value (from " +"the :attr:`return_value`)." msgstr "" #: ../Doc/library/unittest.mock.rst:532 msgid "" -"If you pass in an iterable, it is used to retrieve an iterator which must yield a value on every call. This value can either be an exception instance to be raised, or a " -"value to be returned from the call to the mock (:data:`DEFAULT` handling is identical to the function case)." +"If you pass in an iterable, it is used to retrieve an iterator which must " +"yield a value on every call. This value can either be an exception instance " +"to be raised, or a value to be returned from the call to the mock (:data:" +"`DEFAULT` handling is identical to the function case)." msgstr "" #: ../Doc/library/unittest.mock.rst:537 -msgid "An example of a mock that raises an exception (to test exception handling of an API):" +msgid "" +"An example of a mock that raises an exception (to test exception handling of " +"an API):" msgstr "" #: ../Doc/library/unittest.mock.rst:547 @@ -420,7 +578,9 @@ msgid "Using a callable:" msgstr "" #: ../Doc/library/unittest.mock.rst:564 -msgid ":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:" +msgid "" +":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:" msgstr "" #: ../Doc/library/unittest.mock.rst:574 @@ -429,95 +589,132 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:588 msgid "" -"This is either ``None`` (if the mock hasn't been called), or the arguments that the mock was last called with. This will be in the form of a tuple: the first member is any " -"ordered arguments the mock was called with (or an empty tuple) and the second member is any keyword arguments (or an empty dictionary)." +"This is either ``None`` (if the mock hasn't been called), or the arguments " +"that the mock was last called with. This will be in the form of a tuple: the " +"first member is any ordered arguments the mock was called with (or an empty " +"tuple) and the second member is any keyword arguments (or an empty " +"dictionary)." msgstr "" #: ../Doc/library/unittest.mock.rst:611 msgid "" -":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These are tuples, so they " -"can be unpacked to get at the individual arguments and make more complex assertions. See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" +"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " +"are tuples, so they can be unpacked to get at the individual arguments and " +"make more complex assertions. See :ref:`calls as tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:620 msgid "" -"This is a list of all the calls made to the mock object in sequence (so the length of the list is the number of times it has been called). Before any calls have been made it " -"is an empty list. The :data:`call` object can be used for conveniently constructing lists of calls to compare with :attr:`call_args_list`." +"This is a list of all the calls made to the mock object in sequence (so the " +"length of the list is the number of times it has been called). Before any " +"calls have been made it is an empty list. The :data:`call` object can be " +"used for conveniently constructing lists of calls to compare with :attr:" +"`call_args_list`." msgstr "" #: ../Doc/library/unittest.mock.rst:636 msgid "" -"Members of :attr:`call_args_list` are :data:`call` objects. These can be unpacked as tuples to get at the individual arguments. See :ref:`calls as tuples `." +"Members of :attr:`call_args_list` are :data:`call` objects. These can be " +"unpacked as tuples to get at the individual arguments. See :ref:`calls as " +"tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:643 -msgid "As well as tracking calls to themselves, mocks also track calls to methods and attributes, and *their* methods and attributes:" +msgid "" +"As well as tracking calls to themselves, mocks also track calls to methods " +"and attributes, and *their* methods and attributes:" msgstr "" #: ../Doc/library/unittest.mock.rst:654 msgid "" -"Members of :attr:`method_calls` are :data:`call` objects. These can be unpacked as tuples to get at the individual arguments. See :ref:`calls as tuples `." +"Members of :attr:`method_calls` are :data:`call` objects. These can be " +"unpacked as tuples to get at the individual arguments. See :ref:`calls as " +"tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:661 -msgid ":attr:`mock_calls` records *all* calls to the mock object, its methods, magic methods *and* return value mocks." +msgid "" +":attr:`mock_calls` records *all* calls to the mock object, its methods, " +"magic methods *and* return value mocks." msgstr "" #: ../Doc/library/unittest.mock.rst:679 msgid "" -"Members of :attr:`mock_calls` are :data:`call` objects. These can be unpacked as tuples to get at the individual arguments. See :ref:`calls as tuples `." +"Members of :attr:`mock_calls` are :data:`call` objects. These can be " +"unpacked as tuples to get at the individual arguments. See :ref:`calls as " +"tuples `." msgstr "" #: ../Doc/library/unittest.mock.rst:685 -msgid "The way :attr:`mock_calls` are recorded means that where nested calls are made, the parameters of ancestor calls are not recorded and so will always compare equal:" +msgid "" +"The way :attr:`mock_calls` are recorded means that where nested calls are " +"made, the parameters of ancestor calls are not recorded and so will always " +"compare equal:" msgstr "" #: ../Doc/library/unittest.mock.rst:699 msgid "" -"Normally the :attr:`__class__` attribute of an object will return its type. For a mock object with a :attr:`spec`, ``__class__`` returns the spec class instead. This allows " -"mock objects to pass :func:`isinstance` tests for the object they are replacing / masquerading as:" +"Normally the :attr:`__class__` attribute of an object will return its type. " +"For a mock object with a :attr:`spec`, ``__class__`` returns the spec class " +"instead. This allows mock objects to pass :func:`isinstance` tests for the " +"object they are replacing / masquerading as:" msgstr "" #: ../Doc/library/unittest.mock.rst:708 -msgid ":attr:`__class__` is assignable to, this allows a mock to pass an :func:`isinstance` check without forcing you to use a spec:" +msgid "" +":attr:`__class__` is assignable to, this allows a mock to pass an :func:" +"`isinstance` check without forcing you to use a spec:" msgstr "" #: ../Doc/library/unittest.mock.rst:718 msgid "" -"A non-callable version of :class:`Mock`. The constructor parameters have the same meaning of :class:`Mock`, with the exception of *return_value* and *side_effect* which have " -"no meaning on a non-callable mock." +"A non-callable version of :class:`Mock`. The constructor parameters have the " +"same meaning of :class:`Mock`, with the exception of *return_value* and " +"*side_effect* which have no meaning on a non-callable mock." msgstr "" #: ../Doc/library/unittest.mock.rst:722 -msgid "Mock objects that use a class or an instance as a :attr:`spec` or :attr:`spec_set` are able to pass :func:`isinstance` tests:" +msgid "" +"Mock objects that use a class or an instance as a :attr:`spec` or :attr:" +"`spec_set` are able to pass :func:`isinstance` tests:" msgstr "" #: ../Doc/library/unittest.mock.rst:732 -msgid "The :class:`Mock` classes have support for mocking magic methods. See :ref:`magic methods ` for the full details." +msgid "" +"The :class:`Mock` classes have support for mocking magic methods. See :ref:" +"`magic methods ` for the full details." msgstr "" #: ../Doc/library/unittest.mock.rst:735 msgid "" -"The mock classes and the :func:`patch` decorators all take arbitrary keyword arguments for configuration. For the :func:`patch` decorators the keywords are passed to the " -"constructor of the mock being created. The keyword arguments are for configuring attributes of the mock:" +"The mock classes and the :func:`patch` decorators all take arbitrary keyword " +"arguments for configuration. For the :func:`patch` decorators the keywords " +"are passed to the constructor of the mock being created. The keyword " +"arguments are for configuring attributes of the mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:746 msgid "" -"The return value and side effect of child mocks can be set in the same way, using dotted notation. As you can't use dotted names directly in a call you have to create a " -"dictionary and unpack it using ``**``:" +"The return value and side effect of child mocks can be set in the same way, " +"using dotted notation. As you can't use dotted names directly in a call you " +"have to create a dictionary and unpack it using ``**``:" msgstr "" #: ../Doc/library/unittest.mock.rst:761 msgid "" -"A callable mock which was created with a *spec* (or a *spec_set*) will introspect the specification object's signature when matching calls to the mock. Therefore, it can " -"match the actual call's arguments regardless of whether they were passed positionally or by name::" +"A callable mock which was created with a *spec* (or a *spec_set*) will " +"introspect the specification object's signature when matching calls to the " +"mock. Therefore, it can match the actual call's arguments regardless of " +"whether they were passed positionally or by name::" msgstr "" #: ../Doc/library/unittest.mock.rst:774 msgid "" -"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock.assert_any_call`. When :ref:`auto-" -"speccing`, it will also apply to method calls on the mock object." +"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." +"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." +"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " +"calls on the mock object." msgstr "" #: ../Doc/library/unittest.mock.rst:779 @@ -526,16 +723,22 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:785 msgid "" -"A mock intended to be used as a property, or other descriptor, on a class. :class:`PropertyMock` provides :meth:`__get__` and :meth:`__set__` methods so you can specify a " -"return value when it is fetched." +"A mock intended to be used as a property, or other descriptor, on a class. :" +"class:`PropertyMock` provides :meth:`__get__` and :meth:`__set__` methods so " +"you can specify a return value when it is fetched." msgstr "" #: ../Doc/library/unittest.mock.rst:789 -msgid "Fetching a :class:`PropertyMock` instance from an object calls the mock, with no args. Setting it calls the mock with the value being set." +msgid "" +"Fetching a :class:`PropertyMock` instance from an object calls the mock, " +"with no args. Setting it calls the mock with the value being set." msgstr "" #: ../Doc/library/unittest.mock.rst:810 -msgid "Because of the way mock attributes are stored you can't directly attach a :class:`PropertyMock` to a mock object. Instead you can attach it to the mock type object::" +msgid "" +"Because of the way mock attributes are stored you can't directly attach a :" +"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " +"type object::" msgstr "" #: ../Doc/library/unittest.mock.rst:823 @@ -544,46 +747,65 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:825 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:`~Mock.return_value` attribute. The default return value is a new Mock object; it is created the " -"first time the return value is accessed (either explicitly or by calling the Mock) - but it is stored and the same one returned each time." +"Mock objects are callable. The call will return the value set as the :attr:" +"`~Mock.return_value` attribute. The default return value is a new Mock " +"object; it is created the first time the return value is accessed (either " +"explicitly or by calling the Mock) - but it is stored and the same one " +"returned each time." msgstr "" #: ../Doc/library/unittest.mock.rst:831 -msgid "Calls made to the object will be recorded in the attributes like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." +msgid "" +"Calls made to the object will be recorded in the attributes like :attr:" +"`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" #: ../Doc/library/unittest.mock.rst:834 -msgid "If :attr:`~Mock.side_effect` is set then it will be called after the call has been recorded, so if :attr:`side_effect` raises an exception the call is still recorded." +msgid "" +"If :attr:`~Mock.side_effect` is set then it will be called after the call " +"has been recorded, so if :attr:`side_effect` raises an exception the call is " +"still recorded." msgstr "" #: ../Doc/library/unittest.mock.rst:838 -msgid "The simplest way to make a mock raise an exception when called is to make :attr:`~Mock.side_effect` an exception class or instance:" +msgid "" +"The simplest way to make a mock raise an exception when called is to make :" +"attr:`~Mock.side_effect` an exception class or instance:" msgstr "" #: ../Doc/library/unittest.mock.rst:856 msgid "" -"If :attr:`side_effect` is a function then whatever that function returns is what calls to the mock return. The :attr:`side_effect` function is called with the same arguments " -"as the mock. This allows you to vary the return value of the call dynamically, based on the input:" +"If :attr:`side_effect` is a function then whatever that function returns is " +"what calls to the mock return. The :attr:`side_effect` function is called " +"with the same arguments as the mock. This allows you to vary the return " +"value of the call dynamically, based on the input:" msgstr "" #: ../Doc/library/unittest.mock.rst:872 msgid "" -"If you want the mock to still return the default return value (a new mock), or any set return value, then there are two ways of doing this. Either return :attr:`mock." -"return_value` from inside :attr:`side_effect`, or return :data:`DEFAULT`:" +"If you want the mock to still return the default return value (a new mock), " +"or any set return value, then there are two ways of doing this. Either " +"return :attr:`mock.return_value` from inside :attr:`side_effect`, or return :" +"data:`DEFAULT`:" msgstr "" #: ../Doc/library/unittest.mock.rst:891 -msgid "To remove a :attr:`side_effect`, and return to the default behaviour, set the :attr:`side_effect` to ``None``:" +msgid "" +"To remove a :attr:`side_effect`, and return to the default behaviour, set " +"the :attr:`side_effect` to ``None``:" msgstr "" #: ../Doc/library/unittest.mock.rst:905 msgid "" -"The :attr:`side_effect` can also be any iterable object. Repeated calls to the mock will return values from the iterable (until the iterable is exhausted and a :exc:" -"`StopIteration` is raised):" +"The :attr:`side_effect` can also be any iterable object. Repeated calls to " +"the mock will return values from the iterable (until the iterable is " +"exhausted and a :exc:`StopIteration` is raised):" msgstr "" #: ../Doc/library/unittest.mock.rst:921 -msgid "If any members of the iterable are exceptions they will be raised instead of returned::" +msgid "" +"If any members of the iterable are exceptions they will be raised instead of " +"returned::" msgstr "" #: ../Doc/library/unittest.mock.rst:939 @@ -591,17 +813,23 @@ msgid "Deleting Attributes" msgstr "" #: ../Doc/library/unittest.mock.rst:941 -msgid "Mock objects create attributes on demand. This allows them to pretend to be objects of any type." +msgid "" +"Mock objects create attributes on demand. This allows them to pretend to be " +"objects of any type." msgstr "" #: ../Doc/library/unittest.mock.rst:944 msgid "" -"You may want a mock object to return ``False`` to a :func:`hasattr` call, or raise an :exc:`AttributeError` when an attribute is fetched. You can do this by providing an " -"object as a :attr:`spec` for a mock, but that isn't always convenient." +"You may want a mock object to return ``False`` to a :func:`hasattr` call, or " +"raise an :exc:`AttributeError` when an attribute is fetched. You can do this " +"by providing an object as a :attr:`spec` for a mock, but that isn't always " +"convenient." msgstr "" #: ../Doc/library/unittest.mock.rst:948 -msgid "You \"block\" attributes by deleting them. Once deleted, accessing an attribute will raise an :exc:`AttributeError`." +msgid "" +"You \"block\" attributes by deleting them. Once deleted, accessing an " +"attribute will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:965 @@ -610,12 +838,16 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:967 msgid "" -"Since \"name\" is an argument to the :class:`Mock` constructor, if you want your mock object to have a \"name\" attribute you can't just pass it in at creation time. There " -"are two alternatives. One option is to use :meth:`~Mock.configure_mock`::" +"Since \"name\" is an argument to the :class:`Mock` constructor, if you want " +"your mock object to have a \"name\" attribute you can't just pass it in at " +"creation time. There are two alternatives. One option is to use :meth:`~Mock." +"configure_mock`::" msgstr "" #: ../Doc/library/unittest.mock.rst:977 -msgid "A simpler option is to simply set the \"name\" attribute after mock creation::" +msgid "" +"A simpler option is to simply set the \"name\" attribute after mock " +"creation::" msgstr "" #: ../Doc/library/unittest.mock.rst:984 @@ -624,24 +856,36 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:986 msgid "" -"When you attach a mock as an attribute of another mock (or as the return value) it becomes a \"child\" of that mock. Calls to the child are recorded in the :attr:`~Mock." -"method_calls` and :attr:`~Mock.mock_calls` attributes of the parent. This is useful for configuring child mocks and then attaching them to the parent, or for attaching mocks " -"to a parent that records all calls to the children and allows you to make assertions about the order of calls between mocks:" +"When you attach a mock as an attribute of another mock (or as the return " +"value) it becomes a \"child\" of that mock. Calls to the child are recorded " +"in the :attr:`~Mock.method_calls` and :attr:`~Mock.mock_calls` attributes of " +"the parent. This is useful for configuring child mocks and then attaching " +"them to the parent, or for attaching mocks to a parent that records all " +"calls to the children and allows you to make assertions about the order of " +"calls between mocks:" msgstr "" #: ../Doc/library/unittest.mock.rst:1004 -msgid "The exception to this is if the mock has a name. This allows you to prevent the \"parenting\" if for some reason you don't want it to happen." +msgid "" +"The exception to this is if the mock has a name. This allows you to prevent " +"the \"parenting\" if for some reason you don't want it to happen." msgstr "" #: ../Doc/library/unittest.mock.rst:1015 -msgid "Mocks created for you by :func:`patch` are automatically given names. To attach mocks that have names to a parent you use the :meth:`~Mock.attach_mock` method:" +msgid "" +"Mocks created for you by :func:`patch` are automatically given names. To " +"attach mocks that have names to a parent you use the :meth:`~Mock." +"attach_mock` method:" msgstr "" #: ../Doc/library/unittest.mock.rst:1033 msgid "" -"The only exceptions are magic methods and attributes (those that have leading and trailing double underscores). Mock doesn't create these but instead raises an :exc:" -"`AttributeError`. This is because the interpreter will often implicitly request these methods, and gets *very* confused to get a new Mock object when it expects a magic " -"method. If you need magic method support see :ref:`magic methods `." +"The only exceptions are magic methods and attributes (those that have " +"leading and trailing double underscores). Mock doesn't create these but " +"instead raises an :exc:`AttributeError`. This is because the interpreter " +"will often implicitly request these methods, and gets *very* confused to get " +"a new Mock object when it expects a magic method. If you need magic method " +"support see :ref:`magic methods `." msgstr "" #: ../Doc/library/unittest.mock.rst:1042 @@ -650,8 +894,10 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1044 msgid "" -"The patch decorators are used for patching objects only within the scope of the function they decorate. They automatically handle the unpatching for you, even if exceptions " -"are raised. All of these functions can also be used in with statements or as class decorators." +"The patch decorators are used for patching objects only within the scope of " +"the function they decorate. They automatically handle the unpatching for " +"you, even if exceptions are raised. All of these functions can also be used " +"in with statements or as class decorators." msgstr "" #: ../Doc/library/unittest.mock.rst:1051 @@ -659,135 +905,195 @@ msgid "patch" msgstr "" #: ../Doc/library/unittest.mock.rst:1055 -msgid ":func:`patch` is straightforward to use. The key is to do the patching in the right namespace. See the section `where to patch`_." +msgid "" +":func:`patch` is straightforward to use. The key is to do the patching in " +"the right namespace. See the section `where to patch`_." msgstr "" #: ../Doc/library/unittest.mock.rst:1060 msgid "" -":func:`patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the *target* is patched with a *new* " -"object. When the function/with statement exits the patch is undone." +":func:`patch` acts as a function decorator, class decorator or a context " +"manager. Inside the body of the function or with statement, the *target* is " +"patched with a *new* object. When the function/with statement exits the " +"patch is undone." msgstr "" #: ../Doc/library/unittest.mock.rst:1065 msgid "" -"If *new* is omitted, then the target is replaced with a :class:`MagicMock`. If :func:`patch` is used as a decorator and *new* is omitted, the created mock is passed in as an " -"extra argument to the decorated function. If :func:`patch` is used as a context manager the created mock is returned by the context manager." +"If *new* is omitted, then the target is replaced with a :class:`MagicMock`. " +"If :func:`patch` is used as a decorator and *new* is omitted, the created " +"mock is passed in as an extra argument to the decorated function. If :func:" +"`patch` is used as a context manager the created mock is returned by the " +"context manager." msgstr "" #: ../Doc/library/unittest.mock.rst:1071 msgid "" -"*target* should be a string in the form ``'package.module.ClassName'``. The *target* is imported and the specified object replaced with the *new* object, so the *target* " -"must be importable from the environment you are calling :func:`patch` from. The target is imported when the decorated function is executed, not at decoration time." +"*target* should be a string in the form ``'package.module.ClassName'``. The " +"*target* is imported and the specified object replaced with the *new* " +"object, so the *target* must be importable from the environment you are " +"calling :func:`patch` from. The target is imported when the decorated " +"function is executed, not at decoration time." msgstr "" #: ../Doc/library/unittest.mock.rst:1077 -msgid "The *spec* and *spec_set* keyword arguments are passed to the :class:`MagicMock` if patch is creating one for you." +msgid "" +"The *spec* and *spec_set* keyword arguments are passed to the :class:" +"`MagicMock` if patch is creating one for you." msgstr "" #: ../Doc/library/unittest.mock.rst:1080 -msgid "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes patch to pass in the object being mocked as the spec/spec_set object." +msgid "" +"In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " +"patch to pass in the object being mocked as the spec/spec_set object." msgstr "" #: ../Doc/library/unittest.mock.rst:1083 -msgid "*new_callable* allows you to specify a different class, or callable object, that will be called to create the *new* object. By default :class:`MagicMock` is used." +msgid "" +"*new_callable* allows you to specify a different class, or callable object, " +"that will be called to create the *new* object. By default :class:" +"`MagicMock` is used." msgstr "" #: ../Doc/library/unittest.mock.rst:1087 msgid "" -"A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` then the mock will be created with a spec from the object being replaced. All attributes of the " -"mock will also have the spec of the corresponding attribute of the object being replaced. Methods and functions being mocked will have their arguments checked and will raise " -"a :exc:`TypeError` if they are called with the wrong signature. For mocks replacing a class, their return value (the 'instance') will have the same spec as the class. See " -"the :func:`create_autospec` function and :ref:`auto-speccing`." +"A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " +"then the mock will be created with a spec from the object being replaced. " +"All attributes of the mock will also have the spec of the corresponding " +"attribute of the object being replaced. Methods and functions being mocked " +"will have their arguments checked and will raise a :exc:`TypeError` if they " +"are called with the wrong signature. For mocks replacing a class, their " +"return value (the 'instance') will have the same spec as the class. See the :" +"func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" #: ../Doc/library/unittest.mock.rst:1097 -msgid "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an arbitrary object as the spec instead of the one being replaced." +msgid "" +"Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " +"arbitrary object as the spec instead of the one being replaced." msgstr "" #: ../Doc/library/unittest.mock.rst:1100 msgid "" -"By default :func:`patch` will fail to replace attributes that don't exist. If you pass in ``create=True``, and the attribute doesn't exist, patch will create the attribute " -"for you when the patched function is called, and delete it again after the patched function has exited. This is useful for writing tests against attributes that your " -"production code creates at runtime. It is off by default because it can be dangerous. With it switched on you can write passing tests against APIs that don't actually exist!" +"By default :func:`patch` will fail to replace attributes that don't exist. " +"If you pass in ``create=True``, and the attribute doesn't exist, patch will " +"create the attribute for you when the patched function is called, and delete " +"it again after the patched function has exited. This is useful for writing " +"tests against attributes that your production code creates at runtime. It is " +"off by default because it can be dangerous. With it switched on you can " +"write passing tests against APIs that don't actually exist!" msgstr "" #: ../Doc/library/unittest.mock.rst:1110 -msgid "If you are patching builtins in a module then you don't need to pass ``create=True``, it will be added by default." +msgid "" +"If you are patching builtins in a module then you don't need to pass " +"``create=True``, it will be added by default." msgstr "" #: ../Doc/library/unittest.mock.rst:1114 msgid "" -"Patch can be used as a :class:`TestCase` class decorator. It works by decorating each test method in the class. This reduces the boilerplate code when your test methods " -"share a common patchings set. :func:`patch` finds tests by looking for method names that start with ``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " -"way :mod:`unittest` finds tests. You can specify an alternative prefix by setting ``patch.TEST_PREFIX``." +"Patch can be used as a :class:`TestCase` class decorator. It works by " +"decorating each test method in the class. This reduces the boilerplate code " +"when your test methods share a common patchings set. :func:`patch` finds " +"tests by looking for method names that start with ``patch.TEST_PREFIX``. By " +"default this is ``'test'``, which matches the way :mod:`unittest` finds " +"tests. You can specify an alternative prefix by setting ``patch." +"TEST_PREFIX``." msgstr "" #: ../Doc/library/unittest.mock.rst:1121 msgid "" -"Patch can be used as a context manager, with the with statement. Here the patching applies to the indented block after the with statement. If you use \"as\" then the patched " -"object will be bound to the name after the \"as\"; very useful if :func:`patch` is creating a mock object for you." +"Patch can be used as a context manager, with the with statement. Here the " +"patching applies to the indented block after the with statement. If you use " +"\"as\" then the patched object will be bound to the name after the \"as\"; " +"very useful if :func:`patch` is creating a mock object for you." msgstr "" #: ../Doc/library/unittest.mock.rst:1126 -msgid ":func:`patch` takes arbitrary keyword arguments. These will be passed to the :class:`Mock` (or *new_callable*) on construction." +msgid "" +":func:`patch` takes arbitrary keyword arguments. These will be passed to " +"the :class:`Mock` (or *new_callable*) on construction." msgstr "" #: ../Doc/library/unittest.mock.rst:1129 -msgid "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are available for alternate use-cases." +msgid "" +"``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " +"available for alternate use-cases." msgstr "" #: ../Doc/library/unittest.mock.rst:1132 -msgid ":func:`patch` as function decorator, creating the mock for you and passing it into the decorated function:" +msgid "" +":func:`patch` as function decorator, creating the mock for you and passing " +"it into the decorated function:" msgstr "" #: ../Doc/library/unittest.mock.rst:1142 msgid "" -"Patching a class replaces the class with a :class:`MagicMock` *instance*. If the class is instantiated in the code under test then it will be the :attr:`~Mock.return_value` " -"of the mock that will be used." +"Patching a class replaces the class with a :class:`MagicMock` *instance*. If " +"the class is instantiated in the code under test then it will be the :attr:" +"`~Mock.return_value` of the mock that will be used." msgstr "" #: ../Doc/library/unittest.mock.rst:1146 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively you can set the *return_value* to be " -"anything you want." +"If the class is instantiated multiple times you could use :attr:`~Mock." +"side_effect` to return a new mock each time. Alternatively you can set the " +"*return_value* to be anything you want." msgstr "" #: ../Doc/library/unittest.mock.rst:1150 -msgid "To configure return values on methods of *instances* on the patched class you must do this on the :attr:`return_value`. For example:" +msgid "" +"To configure return values on methods of *instances* on the patched class " +"you must do this on the :attr:`return_value`. For example:" msgstr "" #: ../Doc/library/unittest.mock.rst:1164 -msgid "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, then the return value of the created mock will have the same spec." +msgid "" +"If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " +"then the return value of the created mock will have the same spec." msgstr "" #: ../Doc/library/unittest.mock.rst:1174 msgid "" -"The *new_callable* argument is useful where you want to use an alternative class to the default :class:`MagicMock` for the created mock. For example, if you wanted a :class:" -"`NonCallableMock` to be used:" +"The *new_callable* argument is useful where you want to use an alternative " +"class to the default :class:`MagicMock` for the created mock. For example, " +"if you wanted a :class:`NonCallableMock` to be used:" msgstr "" #: ../Doc/library/unittest.mock.rst:1187 -msgid "Another use case might be to replace an object with an :class:`io.StringIO` instance:" +msgid "" +"Another use case might be to replace an object with an :class:`io.StringIO` " +"instance:" msgstr "" #: ../Doc/library/unittest.mock.rst:1200 msgid "" -"When :func:`patch` is creating a mock for you, it is common that the first thing you need to do is to configure the mock. Some of that configuration can be done in the call " -"to patch. Any arbitrary keywords you pass into the call will be used to set attributes on the created mock:" +"When :func:`patch` is creating a mock for you, it is common that the first " +"thing you need to do is to configure the mock. Some of that configuration " +"can be done in the call to patch. Any arbitrary keywords you pass into the " +"call will be used to set attributes on the created mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:1212 msgid "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks can also be configured. These aren't " -"syntactically valid to pass in directly as keyword arguments, but a dictionary with these as keys can still be expanded into a :func:`patch` call using ``**``:" +"As well as attributes on the created mock attributes, like the :attr:`~Mock." +"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " +"configured. These aren't syntactically valid to pass in directly as keyword " +"arguments, but a dictionary with these as keys can still be expanded into a :" +"func:`patch` call using ``**``:" msgstr "" #: ../Doc/library/unittest.mock.rst:1228 -msgid "By default, attempting to patch a function in a module (or a method or an attribute in a class) that does not exist will fail with :exc:`AttributeError`::" +msgid "" +"By default, attempting to patch a function in a module (or a method or an " +"attribute in a class) that does not exist will fail with :exc:" +"`AttributeError`::" msgstr "" #: ../Doc/library/unittest.mock.rst:1240 -msgid "but adding ``create=True`` in the call to :func:`patch` will make the previous example work as expected::" +msgid "" +"but adding ``create=True`` in the call to :func:`patch` will make the " +"previous example work as expected::" msgstr "" #: ../Doc/library/unittest.mock.rst:1251 @@ -795,31 +1101,44 @@ msgid "patch.object" msgstr "" #: ../Doc/library/unittest.mock.rst:1255 -msgid "patch the named member (*attribute*) on an object (*target*) with a mock object." +msgid "" +"patch the named member (*attribute*) on an object (*target*) with a mock " +"object." msgstr "" #: ../Doc/library/unittest.mock.rst:1258 msgid "" -":func:`patch.object` can be used as a decorator, class decorator or a context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* and *new_callable* have the " -"same meaning as for :func:`patch`. Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments for configuring the mock object it creates." +":func:`patch.object` can be used as a decorator, class decorator or a " +"context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " +"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" +"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " +"configuring the mock object it creates." msgstr "" #: ../Doc/library/unittest.mock.rst:1264 -msgid "When used as a class decorator :func:`patch.object` honours ``patch.TEST_PREFIX`` for choosing which methods to wrap." +msgid "" +"When used as a class decorator :func:`patch.object` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" #: ../Doc/library/unittest.mock.rst:1267 msgid "" -"You can either call :func:`patch.object` with three arguments or two arguments. The three argument form takes the object to be patched, the attribute name and the object to " -"replace the attribute with." +"You can either call :func:`patch.object` with three arguments or two " +"arguments. The three argument form takes the object to be patched, the " +"attribute name and the object to replace the attribute with." msgstr "" #: ../Doc/library/unittest.mock.rst:1271 -msgid "When calling with the two argument form you omit the replacement object, and a mock is created for you and passed in as an extra argument to the decorated function:" +msgid "" +"When calling with the two argument form you omit the replacement object, and " +"a mock is created for you and passed in as an extra argument to the " +"decorated function:" msgstr "" #: ../Doc/library/unittest.mock.rst:1282 -msgid "*spec*, *create* and the other arguments to :func:`patch.object` have the same meaning as they do for :func:`patch`." +msgid "" +"*spec*, *create* and the other arguments to :func:`patch.object` have the " +"same meaning as they do for :func:`patch`." msgstr "" #: ../Doc/library/unittest.mock.rst:1287 @@ -827,49 +1146,69 @@ msgid "patch.dict" msgstr "" #: ../Doc/library/unittest.mock.rst:1291 -msgid "Patch a dictionary, or dictionary like object, and restore the dictionary to its original state after the test." +msgid "" +"Patch a dictionary, or dictionary like object, and restore the dictionary to " +"its original state after the test." msgstr "" #: ../Doc/library/unittest.mock.rst:1294 msgid "" -"*in_dict* can be a dictionary or a mapping like container. If it is a mapping then it must at least support getting, setting and deleting items plus iterating over keys." +"*in_dict* can be a dictionary or a mapping like container. If it is a " +"mapping then it must at least support getting, setting and deleting items " +"plus iterating over keys." msgstr "" #: ../Doc/library/unittest.mock.rst:1298 -msgid "*in_dict* can also be a string specifying the name of the dictionary, which will then be fetched by importing it." +msgid "" +"*in_dict* can also be a string specifying the name of the dictionary, which " +"will then be fetched by importing it." msgstr "" #: ../Doc/library/unittest.mock.rst:1301 -msgid "*values* can be a dictionary of values to set in the dictionary. *values* can also be an iterable of ``(key, value)`` pairs." +msgid "" +"*values* can be a dictionary of values to set in the dictionary. *values* " +"can also be an iterable of ``(key, value)`` pairs." msgstr "" #: ../Doc/library/unittest.mock.rst:1304 -msgid "If *clear* is true then the dictionary will be cleared before the new values are set." +msgid "" +"If *clear* is true then the dictionary will be cleared before the new values " +"are set." msgstr "" #: ../Doc/library/unittest.mock.rst:1307 -msgid ":func:`patch.dict` can also be called with arbitrary keyword arguments to set values in the dictionary." +msgid "" +":func:`patch.dict` can also be called with arbitrary keyword arguments to " +"set values in the dictionary." msgstr "" #: ../Doc/library/unittest.mock.rst:1310 msgid "" -":func:`patch.dict` can be used as a context manager, decorator or class decorator. When used as a class decorator :func:`patch.dict` honours ``patch.TEST_PREFIX`` for " -"choosing which methods to wrap." +":func:`patch.dict` can be used as a context manager, decorator or class " +"decorator. When used as a class decorator :func:`patch.dict` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" #: ../Doc/library/unittest.mock.rst:1314 -msgid ":func:`patch.dict` can be used to add members to a dictionary, or simply let a test change a dictionary, and ensure the dictionary is restored when the test ends." +msgid "" +":func:`patch.dict` can be used to add members to a dictionary, or simply let " +"a test change a dictionary, and ensure the dictionary is restored when the " +"test ends." msgstr "" #: ../Doc/library/unittest.mock.rst:1331 -msgid "Keywords can be used in the :func:`patch.dict` call to set values in the dictionary:" +msgid "" +"Keywords can be used in the :func:`patch.dict` call to set values in the " +"dictionary:" msgstr "" #: ../Doc/library/unittest.mock.rst:1341 msgid "" -":func:`patch.dict` can be used with dictionary like objects that aren't actually dictionaries. At the very minimum they must support item getting, setting, deleting and " -"either iteration or membership test. This corresponds to the magic methods :meth:`__getitem__`, :meth:`__setitem__`, :meth:`__delitem__` and either :meth:`__iter__` or :meth:" -"`__contains__`." +":func:`patch.dict` can be used with dictionary like objects that aren't " +"actually dictionaries. At the very minimum they must support item getting, " +"setting, deleting and either iteration or membership test. This corresponds " +"to the magic methods :meth:`__getitem__`, :meth:`__setitem__`, :meth:" +"`__delitem__` and either :meth:`__iter__` or :meth:`__contains__`." msgstr "" #: ../Doc/library/unittest.mock.rst:1370 @@ -878,39 +1217,53 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1374 msgid "" -"Perform multiple patches in a single call. It takes the object to be patched (either as an object or a string to fetch the object by importing) and keyword arguments for the " -"patches::" +"Perform multiple patches in a single call. It takes the object to be patched " +"(either as an object or a string to fetch the object by importing) and " +"keyword arguments for the patches::" msgstr "" #: ../Doc/library/unittest.mock.rst:1381 msgid "" -"Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to create mocks for you. In this case the created mocks are passed into a decorated function by keyword, " -"and a dictionary is returned when :func:`patch.multiple` is used as a context manager." +"Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " +"create mocks for you. In this case the created mocks are passed into a " +"decorated function by keyword, and a dictionary is returned when :func:" +"`patch.multiple` is used as a context manager." msgstr "" #: ../Doc/library/unittest.mock.rst:1386 msgid "" -":func:`patch.multiple` can be used as a decorator, class decorator or a context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and *new_callable* have the " -"same meaning as for :func:`patch`. These arguments will be applied to *all* patches done by :func:`patch.multiple`." +":func:`patch.multiple` can be used as a decorator, class decorator or a " +"context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " +"*new_callable* have the same meaning as for :func:`patch`. These arguments " +"will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" #: ../Doc/library/unittest.mock.rst:1391 -msgid "When used as a class decorator :func:`patch.multiple` honours ``patch.TEST_PREFIX`` for choosing which methods to wrap." +msgid "" +"When used as a class decorator :func:`patch.multiple` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" #: ../Doc/library/unittest.mock.rst:1394 msgid "" -"If you want :func:`patch.multiple` to create mocks for you, then you can use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a decorator then the created " -"mocks are passed into the decorated function by keyword." +"If you want :func:`patch.multiple` to create mocks for you, then you can " +"use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " +"decorator then the created mocks are passed into the decorated function by " +"keyword." msgstr "" #: ../Doc/library/unittest.mock.rst:1408 msgid "" -":func:`patch.multiple` can be nested with other ``patch`` decorators, but put arguments passed by keyword *after* any of the standard arguments created by :func:`patch`:" +":func:`patch.multiple` can be nested with other ``patch`` decorators, but " +"put arguments passed by keyword *after* any of the standard arguments " +"created by :func:`patch`:" msgstr "" #: ../Doc/library/unittest.mock.rst:1420 -msgid "If :func:`patch.multiple` is used as a context manager, the value returned by the context manager is a dictionary where created mocks are keyed by name::" +msgid "" +"If :func:`patch.multiple` is used as a context manager, the value returned " +"by the context manager is a dictionary where created mocks are keyed by " +"name::" msgstr "" #: ../Doc/library/unittest.mock.rst:1434 @@ -919,36 +1272,49 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1436 msgid "" -"All the patchers have :meth:`start` and :meth:`stop` methods. These make it simpler to do patching in ``setUp`` methods or where you want to do multiple patches without " -"nesting decorators or with statements." +"All the patchers have :meth:`start` and :meth:`stop` methods. These make it " +"simpler to do patching in ``setUp`` methods or where you want to do multiple " +"patches without nesting decorators or with statements." msgstr "" #: ../Doc/library/unittest.mock.rst:1440 msgid "" -"To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` as normal and keep a reference to the returned ``patcher`` object. You can then call :meth:`start` " -"to put the patch in place and :meth:`stop` to undo it." +"To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " +"as normal and keep a reference to the returned ``patcher`` object. You can " +"then call :meth:`start` to put the patch in place and :meth:`stop` to undo " +"it." msgstr "" #: ../Doc/library/unittest.mock.rst:1444 -msgid "If you are using :func:`patch` to create a mock for you then it will be returned by the call to ``patcher.start``." +msgid "" +"If you are using :func:`patch` to create a mock for you then it will be " +"returned by the call to ``patcher.start``." msgstr "" #: ../Doc/library/unittest.mock.rst:1458 -msgid "A typical use case for this might be for doing multiple patches in the ``setUp`` method of a :class:`TestCase`:" +msgid "" +"A typical use case for this might be for doing multiple patches in the " +"``setUp`` method of a :class:`TestCase`:" msgstr "" #: ../Doc/library/unittest.mock.rst:1480 msgid "" -"If you use this technique you must ensure that the patching is \"undone\" by calling ``stop``. This can be fiddlier than you might think, because if an exception is raised " -"in the ``setUp`` then ``tearDown`` is not called. :meth:`unittest.TestCase.addCleanup` makes this easier:" +"If you use this technique you must ensure that the patching is \"undone\" by " +"calling ``stop``. This can be fiddlier than you might think, because if an " +"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" +"`unittest.TestCase.addCleanup` makes this easier:" msgstr "" #: ../Doc/library/unittest.mock.rst:1495 -msgid "As an added bonus you no longer need to keep a reference to the ``patcher`` object." +msgid "" +"As an added bonus you no longer need to keep a reference to the ``patcher`` " +"object." msgstr "" #: ../Doc/library/unittest.mock.rst:1498 -msgid "It is also possible to stop all patches which have been started by using :func:`patch.stopall`." +msgid "" +"It is also possible to stop all patches which have been started by using :" +"func:`patch.stopall`." msgstr "" #: ../Doc/library/unittest.mock.rst:1503 @@ -960,7 +1326,9 @@ msgid "patch builtins" msgstr "" #: ../Doc/library/unittest.mock.rst:1510 -msgid "You can patch any builtins within a module. The following example patches builtin :func:`ord`:" +msgid "" +"You can patch any builtins within a module. The following example patches " +"builtin :func:`ord`:" msgstr "" #: ../Doc/library/unittest.mock.rst:1523 @@ -969,12 +1337,17 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1525 msgid "" -"All of the patchers can be used as class decorators. When used in this way they wrap every test method on the class. The patchers recognise methods that start with " -"``'test'`` as being test methods. This is the same way that the :class:`unittest.TestLoader` finds test methods by default." +"All of the patchers can be used as class decorators. When used in this way " +"they wrap every test method on the class. The patchers recognise methods " +"that start with ``'test'`` as being test methods. This is the same way that " +"the :class:`unittest.TestLoader` finds test methods by default." msgstr "" #: ../Doc/library/unittest.mock.rst:1530 -msgid "It is possible that you want to use a different prefix for your tests. You can inform the patchers of the different prefix by setting ``patch.TEST_PREFIX``:" +msgid "" +"It is possible that you want to use a different prefix for your tests. You " +"can inform the patchers of the different prefix by setting ``patch." +"TEST_PREFIX``:" msgstr "" #: ../Doc/library/unittest.mock.rst:1553 @@ -982,7 +1355,9 @@ msgid "Nesting Patch Decorators" msgstr "" #: ../Doc/library/unittest.mock.rst:1555 -msgid "If you want to perform multiple patches then you can simply stack up the decorators." +msgid "" +"If you want to perform multiple patches then you can simply stack up the " +"decorators." msgstr "" #: ../Doc/library/unittest.mock.rst:1558 @@ -991,8 +1366,9 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1574 msgid "" -"Note that the decorators are applied from the bottom upwards. This is the standard way that Python applies decorators. The order of the created mocks passed into your test " -"function matches this order." +"Note that the decorators are applied from the bottom upwards. This is the " +"standard way that Python applies decorators. The order of the created mocks " +"passed into your test function matches this order." msgstr "" #: ../Doc/library/unittest.mock.rst:1582 @@ -1001,37 +1377,49 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1584 msgid "" -":func:`patch` works by (temporarily) changing the object that a *name* points to with another one. There can be many names pointing to any individual object, so for patching " -"to work you must ensure that you patch the name used by the system under test." +":func:`patch` works by (temporarily) changing the object that a *name* " +"points to with another one. There can be many names pointing to any " +"individual object, so for patching to work you must ensure that you patch " +"the name used by the system under test." msgstr "" #: ../Doc/library/unittest.mock.rst:1589 msgid "" -"The basic principle is that you patch where an object is *looked up*, which is not necessarily the same place as where it is defined. A couple of examples will help to " -"clarify this." +"The basic principle is that you patch where an object is *looked up*, which " +"is not necessarily the same place as where it is defined. A couple of " +"examples will help to clarify this." msgstr "" #: ../Doc/library/unittest.mock.rst:1593 -msgid "Imagine we have a project that we want to test with the following structure::" +msgid "" +"Imagine we have a project that we want to test with the following structure::" msgstr "" #: ../Doc/library/unittest.mock.rst:1602 msgid "" -"Now we want to test ``some_function`` but we want to mock out ``SomeClass`` using :func:`patch`. The problem is that when we import module b, which we will have to do then " -"it imports ``SomeClass`` from module a. If we use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; module b already has a reference to the " -"*real* ``SomeClass`` and it looks like our patching had no effect." +"Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " +"using :func:`patch`. The problem is that when we import module b, which we " +"will have to do then it imports ``SomeClass`` from module a. If we use :func:" +"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " +"module b already has a reference to the *real* ``SomeClass`` and it looks " +"like our patching had no effect." msgstr "" #: ../Doc/library/unittest.mock.rst:1609 msgid "" -"The key is to patch out ``SomeClass`` where it is used (or where it is looked up). In this case ``some_function`` will actually look up ``SomeClass`` in module b, where we " -"have imported it. The patching should look like::" +"The key is to patch out ``SomeClass`` where it is used (or where it is " +"looked up). In this case ``some_function`` will actually look up " +"``SomeClass`` in module b, where we have imported it. The patching should " +"look like::" msgstr "" #: ../Doc/library/unittest.mock.rst:1615 msgid "" -"However, consider the alternative scenario where instead of ``from a import SomeClass`` module b does ``import a`` and ``some_function`` uses ``a.SomeClass``. Both of these " -"import forms are common. In this case the class we want to patch is being looked up in the module and so we have to patch ``a.SomeClass`` instead::" +"However, consider the alternative scenario where instead of ``from a import " +"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." +"SomeClass``. Both of these import forms are common. In this case the class " +"we want to patch is being looked up in the module and so we have to patch " +"``a.SomeClass`` instead::" msgstr "" #: ../Doc/library/unittest.mock.rst:1624 @@ -1040,9 +1428,11 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1626 msgid "" -"Both patch_ and patch.object_ correctly patch and restore descriptors: class methods, static methods and properties. You should patch these on the *class* rather than an " -"instance. They also work with *some* objects that proxy attribute access, like the `django settings object `_." +"Both patch_ and patch.object_ correctly patch and restore descriptors: class " +"methods, static methods and properties. You should patch these on the " +"*class* rather than an instance. They also work with *some* objects that " +"proxy attribute access, like the `django settings object `_." msgstr "" #: ../Doc/library/unittest.mock.rst:1634 @@ -1055,32 +1445,43 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1641 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known as \"magic methods\". This allows mock objects to replace containers or other objects that implement " -"Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known as " +"\"magic methods\". This allows mock objects to replace containers or other " +"objects that implement Python protocols." msgstr "" #: ../Doc/library/unittest.mock.rst:1645 msgid "" -"Because magic methods are looked up differently from normal methods [#]_, this support has been specially implemented. This means that only specific magic methods are " -"supported. The supported list includes *almost* all of them. If there are any missing that you need please let us know." +"Because magic methods are looked up differently from normal methods [#]_, " +"this support has been specially implemented. This means that only specific " +"magic methods are supported. The supported list includes *almost* all of " +"them. If there are any missing that you need please let us know." msgstr "" #: ../Doc/library/unittest.mock.rst:1650 msgid "" -"You mock magic methods by setting the method you are interested in to a function or a mock instance. If you are using a function then it *must* take ``self`` as the first " -"argument [#]_." +"You mock magic methods by setting the method you are interested in to a " +"function or a mock instance. If you are using a function then it *must* take " +"``self`` as the first argument [#]_." msgstr "" #: ../Doc/library/unittest.mock.rst:1673 -msgid "One use case for this is for mocking objects used as context managers in a :keyword:`with` statement:" +msgid "" +"One use case for this is for mocking objects used as context managers in a :" +"keyword:`with` statement:" msgstr "" #: ../Doc/library/unittest.mock.rst:1685 -msgid "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they are recorded in :attr:`~Mock.mock_calls`." +msgid "" +"Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " +"are recorded in :attr:`~Mock.mock_calls`." msgstr "" #: ../Doc/library/unittest.mock.rst:1690 -msgid "If you use the *spec* keyword argument to create a mock then attempting to set a magic method that isn't in the spec will raise an :exc:`AttributeError`." +msgid "" +"If you use the *spec* keyword argument to create a mock then attempting to " +"set a magic method that isn't in the spec will raise an :exc:" +"`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:1693 @@ -1100,11 +1501,16 @@ msgid "``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__floor__``, ``__trunc__`` et ``__ceil__``" #: ../Doc/library/unittest.mock.rst:1698 -msgid "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and ``__ne__``" +msgid "" +"Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " +"``__ne__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1700 -msgid "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, ``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and ``__missing__``" +msgid "" +"Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " +"``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " +"``__missing__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1703 @@ -1117,12 +1523,17 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1705 msgid "" -"The numeric methods (including right hand and in-place variants): ``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__div__``, ``__truediv__``, ``__floordiv__``, " -"``__mod__``, ``__divmod__``, ``__lshift__``, ``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``" +"The numeric methods (including right hand and in-place variants): " +"``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__div__``, " +"``__truediv__``, ``__floordiv__``, ``__mod__``, ``__divmod__``, " +"``__lshift__``, ``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and " +"``__pow__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1709 -msgid "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and ``__index__``" +msgid "" +"Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " +"``__index__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1711 @@ -1130,11 +1541,15 @@ msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1712 -msgid "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, ``__getstate__`` and ``__setstate__``" +msgid "" +"Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " +"``__getnewargs__``, ``__getstate__`` and ``__setstate__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1716 -msgid "The following methods exist but are *not* supported as they are either in use by mock, can't be set dynamically, or can cause problems:" +msgid "" +"The following methods exist but are *not* supported as they are either in " +"use by mock, can't be set dynamically, or can cause problems:" msgstr "" #: ../Doc/library/unittest.mock.rst:1719 @@ -1142,7 +1557,8 @@ msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1720 -msgid "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" +msgid "" +"``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1725 @@ -1150,13 +1566,16 @@ msgid "Magic Mock" msgstr "" #: ../Doc/library/unittest.mock.rst:1727 -msgid "There are two ``MagicMock`` variants: :class:`MagicMock` and :class:`NonCallableMagicMock`." +msgid "" +"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" +"`NonCallableMagicMock`." msgstr "" #: ../Doc/library/unittest.mock.rst:1732 msgid "" -"``MagicMock`` is a subclass of :class:`Mock` with default implementations of most of the magic methods. You can use ``MagicMock`` without having to configure the magic " -"methods yourself." +"``MagicMock`` is a subclass of :class:`Mock` with default implementations of " +"most of the magic methods. You can use ``MagicMock`` without having to " +"configure the magic methods yourself." msgstr "" #: ../Doc/library/unittest.mock.rst:1736 @@ -1164,7 +1583,9 @@ msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "" #: ../Doc/library/unittest.mock.rst:1738 -msgid "If you use the *spec* or *spec_set* arguments then *only* magic methods that exist in the spec will be created." +msgid "" +"If you use the *spec* or *spec_set* arguments then *only* magic methods that " +"exist in the spec will be created." msgstr "" #: ../Doc/library/unittest.mock.rst:1744 @@ -1173,18 +1594,24 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1746 msgid "" -"The constructor parameters have the same meaning as for :class:`MagicMock`, with the exception of *return_value* and *side_effect* which have no meaning on a non-callable " -"mock." +"The constructor parameters have the same meaning as for :class:`MagicMock`, " +"with the exception of *return_value* and *side_effect* which have no meaning " +"on a non-callable mock." msgstr "" #: ../Doc/library/unittest.mock.rst:1750 -msgid "The magic methods are setup with :class:`MagicMock` objects, so you can configure them and use them in the usual way:" +msgid "" +"The magic methods are setup with :class:`MagicMock` objects, so you can " +"configure them and use them in the usual way:" msgstr "" #: ../Doc/library/unittest.mock.rst:1760 msgid "" -"By default many of the protocol methods are required to return objects of a specific type. These methods are preconfigured with a default return value, so that they can be " -"used without you having to do anything if you aren't interested in the return value. You can still *set* the return value manually if you want to change the default." +"By default many of the protocol methods are required to return objects of a " +"specific type. These methods are preconfigured with a default return value, " +"so that they can be used without you having to do anything if you aren't " +"interested in the return value. You can still *set* the return value " +"manually if you want to change the default." msgstr "" #: ../Doc/library/unittest.mock.rst:1766 @@ -1261,24 +1688,35 @@ msgstr "Par exemple :" #: ../Doc/library/unittest.mock.rst:1797 msgid "" -"The two equality methods, :meth:`__eq__` and :meth:`__ne__`, are special. They do the default equality comparison on identity, using the :attr:`~Mock.side_effect` attribute, " -"unless you change their return value to return something else::" +"The two equality methods, :meth:`__eq__` and :meth:`__ne__`, are special. " +"They do the default equality comparison on identity, using the :attr:`~Mock." +"side_effect` attribute, unless you change their return value to return " +"something else::" msgstr "" #: ../Doc/library/unittest.mock.rst:1811 -msgid "The return value of :meth:`MagicMock.__iter__` can be any iterable object and isn't required to be an iterator:" +msgid "" +"The return value of :meth:`MagicMock.__iter__` can be any iterable object " +"and isn't required to be an iterator:" msgstr "" #: ../Doc/library/unittest.mock.rst:1821 -msgid "If the return value *is* an iterator, then iterating over it once will consume it and subsequent iterations will result in an empty list:" +msgid "" +"If the return value *is* an iterator, then iterating over it once will " +"consume it and subsequent iterations will result in an empty list:" msgstr "" #: ../Doc/library/unittest.mock.rst:1830 -msgid "``MagicMock`` has all of the supported magic methods configured except for some of the obscure and obsolete ones. You can still set these up if you want." +msgid "" +"``MagicMock`` has all of the supported magic methods configured except for " +"some of the obscure and obsolete ones. You can still set these up if you " +"want." msgstr "" #: ../Doc/library/unittest.mock.rst:1833 -msgid "Magic methods that are supported but not setup by default in ``MagicMock`` are:" +msgid "" +"Magic methods that are supported but not setup by default in ``MagicMock`` " +"are:" msgstr "" #: ../Doc/library/unittest.mock.rst:1835 @@ -1302,7 +1740,9 @@ msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` et ``__missing__``" #: ../Doc/library/unittest.mock.rst:1840 -msgid "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, ``__getstate__`` and ``__setstate__``" +msgid "" +"``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " +"``__getstate__`` and ``__setstate__``" msgstr "" #: ../Doc/library/unittest.mock.rst:1842 @@ -1311,12 +1751,15 @@ msgstr "``__getformat__`` et ``__setformat__``" #: ../Doc/library/unittest.mock.rst:1846 msgid "" -"Magic methods *should* be looked up on the class rather than the instance. Different versions of Python are inconsistent about applying this rule. The supported protocol " -"methods should work with all supported versions of Python." +"Magic methods *should* be looked up on the class rather than the instance. " +"Different versions of Python are inconsistent about applying this rule. The " +"supported protocol methods should work with all supported versions of Python." msgstr "" #: ../Doc/library/unittest.mock.rst:1850 -msgid "The function is basically hooked up to the class, but each ``Mock`` instance is kept isolated from the others." +msgid "" +"The function is basically hooked up to the class, but each ``Mock`` instance " +"is kept isolated from the others." msgstr "" #: ../Doc/library/unittest.mock.rst:1855 @@ -1328,27 +1771,36 @@ msgid "sentinel" msgstr "" #: ../Doc/library/unittest.mock.rst:1862 -msgid "The ``sentinel`` object provides a convenient way of providing unique objects for your tests." +msgid "" +"The ``sentinel`` object provides a convenient way of providing unique " +"objects for your tests." msgstr "" #: ../Doc/library/unittest.mock.rst:1865 msgid "" -"Attributes are created on demand when you access them by name. Accessing the same attribute will always return the same object. The objects returned have a sensible repr so " -"that test failure messages are readable." +"Attributes are created on demand when you access them by name. Accessing the " +"same attribute will always return the same object. The objects returned have " +"a sensible repr so that test failure messages are readable." msgstr "" #: ../Doc/library/unittest.mock.rst:1869 -msgid "The ``sentinel`` attributes now preserve their identity when they are :mod:`copied ` or :mod:`pickled `." +msgid "" +"The ``sentinel`` attributes now preserve their identity when they are :mod:" +"`copied ` or :mod:`pickled `." msgstr "" #: ../Doc/library/unittest.mock.rst:1873 msgid "" -"Sometimes when testing you need to test that a specific object is passed as an argument to another method, or returned. It can be common to create named sentinel objects to " -"test this. :data:`sentinel` provides a convenient way of creating and testing the identity of objects like this." +"Sometimes when testing you need to test that a specific object is passed as " +"an argument to another method, or returned. It can be common to create named " +"sentinel objects to test this. :data:`sentinel` provides a convenient way of " +"creating and testing the identity of objects like this." msgstr "" #: ../Doc/library/unittest.mock.rst:1878 -msgid "In this example we monkey patch ``method`` to return ``sentinel.some_object``:" +msgid "" +"In this example we monkey patch ``method`` to return ``sentinel." +"some_object``:" msgstr "" #: ../Doc/library/unittest.mock.rst:1890 @@ -1357,8 +1809,9 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1895 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to indicate that the normal " -"return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." +"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " +"indicate that the normal return value should be used." msgstr "" #: ../Doc/library/unittest.mock.rst:1901 @@ -1367,41 +1820,57 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:1905 msgid "" -":func:`call` is a helper object for making simpler assertions, for comparing with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` and :attr:" -"`~Mock.method_calls`. :func:`call` can also be used with :meth:`~Mock.assert_has_calls`." +":func:`call` is a helper object for making simpler assertions, for comparing " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." +"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :meth:`~Mock.assert_has_calls`." msgstr "" #: ../Doc/library/unittest.mock.rst:1918 -msgid "For a call object that represents multiple calls, :meth:`call_list` returns a list of all the intermediate calls as well as the final call." +msgid "" +"For a call object that represents multiple calls, :meth:`call_list` returns " +"a list of all the intermediate calls as well as the final call." msgstr "" #: ../Doc/library/unittest.mock.rst:1922 msgid "" -"``call_list`` is particularly useful for making assertions on \"chained calls\". A chained call is multiple calls on a single line of code. This results in multiple entries " -"in :attr:`~Mock.mock_calls` on a mock. Manually constructing the sequence of calls can be tedious." +"``call_list`` is particularly useful for making assertions on \"chained calls" +"\". A chained call is multiple calls on a single line of code. This results " +"in multiple entries in :attr:`~Mock.mock_calls` on a mock. Manually " +"constructing the sequence of calls can be tedious." msgstr "" #: ../Doc/library/unittest.mock.rst:1927 -msgid ":meth:`~call.call_list` can construct the sequence of calls from the same chained call:" +msgid "" +":meth:`~call.call_list` can construct the sequence of calls from the same " +"chained call:" msgstr "" #: ../Doc/library/unittest.mock.rst:1944 msgid "" -"A ``call`` object is either a tuple of (positional args, keyword args) or (name, positional args, keyword args) depending on how it was constructed. When you construct them " -"yourself this isn't particularly interesting, but the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` and :attr:`Mock.mock_calls` " -"attributes can be introspected to get at the individual arguments they contain." +"A ``call`` object is either a tuple of (positional args, keyword args) or " +"(name, positional args, keyword args) depending on how it was constructed. " +"When you construct them yourself this isn't particularly interesting, but " +"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." +"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " +"to get at the individual arguments they contain." msgstr "" #: ../Doc/library/unittest.mock.rst:1951 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword args) whereas the ``call`` objects in :attr:`Mock." -"mock_calls`, along with ones you construct yourself, are three-tuples of (name, positional args, keyword args)." +"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." +"call_args_list` are two-tuples of (positional args, keyword args) whereas " +"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " +"construct yourself, are three-tuples of (name, positional args, keyword " +"args)." msgstr "" #: ../Doc/library/unittest.mock.rst:1956 msgid "" -"You can use their \"tupleness\" to pull out the individual arguments for more complex introspection and assertions. The positional arguments are a tuple (an empty tuple if " -"there are no positional arguments) and the keyword arguments are a dictionary:" +"You can use their \"tupleness\" to pull out the individual arguments for " +"more complex introspection and assertions. The positional arguments are a " +"tuple (an empty tuple if there are no positional arguments) and the keyword " +"arguments are a dictionary:" msgstr "" #: ../Doc/library/unittest.mock.rst:1990 @@ -1409,29 +1878,41 @@ msgid "create_autospec" msgstr "" #: ../Doc/library/unittest.mock.rst:1994 -msgid "Create a mock object using another object as a spec. Attributes on the mock will use the corresponding attribute on the *spec* object as their spec." +msgid "" +"Create a mock object using another object as a spec. Attributes on the mock " +"will use the corresponding attribute on the *spec* object as their spec." msgstr "" #: ../Doc/library/unittest.mock.rst:1998 -msgid "Functions or methods being mocked will have their arguments checked to ensure that they are called with the correct signature." +msgid "" +"Functions or methods being mocked will have their arguments checked to " +"ensure that they are called with the correct signature." msgstr "" #: ../Doc/library/unittest.mock.rst:2001 -msgid "If *spec_set* is ``True`` then attempting to set attributes that don't exist on the spec object will raise an :exc:`AttributeError`." +msgid "" +"If *spec_set* is ``True`` then attempting to set attributes that don't exist " +"on the spec object will raise an :exc:`AttributeError`." msgstr "" #: ../Doc/library/unittest.mock.rst:2004 msgid "" -"If a class is used as a spec then the return value of the mock (the instance of the class) will have the same spec. You can use a class as the spec for an instance object by " -"passing ``instance=True``. The returned mock will only be callable if instances of the mock are callable." +"If a class is used as a spec then the return value of the mock (the instance " +"of the class) will have the same spec. You can use a class as the spec for " +"an instance object by passing ``instance=True``. The returned mock will only " +"be callable if instances of the mock are callable." msgstr "" #: ../Doc/library/unittest.mock.rst:2009 -msgid ":func:`create_autospec` also takes arbitrary keyword arguments that are passed to the constructor of the created mock." +msgid "" +":func:`create_autospec` also takes arbitrary keyword arguments that are " +"passed to the constructor of the created mock." msgstr "" #: ../Doc/library/unittest.mock.rst:2012 -msgid "See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:`create_autospec` and the *autospec* argument to :func:`patch`." +msgid "" +"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" +"`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" #: ../Doc/library/unittest.mock.rst:2017 @@ -1440,18 +1921,23 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2021 msgid "" -"Sometimes you may need to make assertions about *some* of the arguments in a call to mock, but either not care about some of the arguments or want to pull them individually " -"out of :attr:`~Mock.call_args` and make more complex assertions on them." +"Sometimes you may need to make assertions about *some* of the arguments in a " +"call to mock, but either not care about some of the arguments or want to " +"pull them individually out of :attr:`~Mock.call_args` and make more complex " +"assertions on them." msgstr "" #: ../Doc/library/unittest.mock.rst:2026 msgid "" -"To ignore certain arguments you can pass in objects that compare equal to *everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock.assert_called_once_with` " -"will then succeed no matter what was passed in." +"To ignore certain arguments you can pass in objects that compare equal to " +"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." +"assert_called_once_with` will then succeed no matter what was passed in." msgstr "" #: ../Doc/library/unittest.mock.rst:2035 -msgid ":data:`ANY` can also be used in comparisons with call lists like :attr:`~Mock.mock_calls`:" +msgid "" +":data:`ANY` can also be used in comparisons with call lists like :attr:" +"`~Mock.mock_calls`:" msgstr "" #: ../Doc/library/unittest.mock.rst:2048 @@ -1460,26 +1946,36 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2052 msgid "" -":data:`FILTER_DIR` is a module level variable that controls the way mock objects respond to :func:`dir` (only for Python 2.6 or more recent). The default is ``True``, which " -"uses the filtering described below, to only show useful members. If you dislike this filtering, or need to switch it off for diagnostic purposes, then set ``mock.FILTER_DIR " -"= False``." +":data:`FILTER_DIR` is a module level variable that controls the way mock " +"objects respond to :func:`dir` (only for Python 2.6 or more recent). The " +"default is ``True``, which uses the filtering described below, to only show " +"useful members. If you dislike this filtering, or need to switch it off for " +"diagnostic purposes, then set ``mock.FILTER_DIR = False``." msgstr "" #: ../Doc/library/unittest.mock.rst:2058 msgid "" -"With filtering on, ``dir(some_mock)`` shows only useful attributes and will include any dynamically created attributes that wouldn't normally be shown. If the mock was " -"created with a *spec* (or *autospec* of course) then all the attributes from the original are shown, even if they haven't been accessed yet:" +"With filtering on, ``dir(some_mock)`` shows only useful attributes and will " +"include any dynamically created attributes that wouldn't normally be shown. " +"If the mock was created with a *spec* (or *autospec* of course) then all the " +"attributes from the original are shown, even if they haven't been accessed " +"yet:" msgstr "" #: ../Doc/library/unittest.mock.rst:2079 msgid "" -"Many of the not-very-useful (private to :class:`Mock` rather than the thing being mocked) underscore and double underscore prefixed attributes have been filtered from the " -"result of calling :func:`dir` on a :class:`Mock`. If you dislike this behaviour you can switch it off by setting the module level switch :data:`FILTER_DIR`:" +"Many of the not-very-useful (private to :class:`Mock` rather than the thing " +"being mocked) underscore and double underscore prefixed attributes have been " +"filtered from the result of calling :func:`dir` on a :class:`Mock`. If you " +"dislike this behaviour you can switch it off by setting the module level " +"switch :data:`FILTER_DIR`:" msgstr "" #: ../Doc/library/unittest.mock.rst:2097 msgid "" -"Alternatively you can just use ``vars(my_mock)`` (instance members) and ``dir(type(my_mock))`` (type members) to bypass the filtering irrespective of :data:`mock.FILTER_DIR`." +"Alternatively you can just use ``vars(my_mock)`` (instance members) and " +"``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " +"of :data:`mock.FILTER_DIR`." msgstr "" #: ../Doc/library/unittest.mock.rst:2103 @@ -1487,27 +1983,36 @@ msgid "mock_open" msgstr "" #: ../Doc/library/unittest.mock.rst:2107 -msgid "A helper function to create a mock to replace the use of :func:`open`. It works for :func:`open` called directly or used as a context manager." +msgid "" +"A helper function to create a mock to replace the use of :func:`open`. It " +"works for :func:`open` called directly or used as a context manager." msgstr "" #: ../Doc/library/unittest.mock.rst:2110 msgid "" -"The *mock* argument is the mock object to configure. If ``None`` (the default) then a :class:`MagicMock` will be created for you, with the API limited to methods or " -"attributes available on standard file handles." +"The *mock* argument is the mock object to configure. If ``None`` (the " +"default) then a :class:`MagicMock` will be created for you, with the API " +"limited to methods or attributes available on standard file handles." msgstr "" #: ../Doc/library/unittest.mock.rst:2114 msgid "" -"*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to return. Calls to those " -"methods will take data from *read_data* until it is depleted. The mock of these methods is pretty simplistic: every time the *mock* is called, the *read_data* is rewound to " -"the start. If you need more control over the data that you are feeding to the tested code you will need to customize this mock for yourself. When that is insufficient, one " -"of the in-memory filesystem packages on `PyPI `_ can offer a realistic filesystem for testing." +"*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase." +"readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to " +"return. Calls to those methods will take data from *read_data* until it is " +"depleted. The mock of these methods is pretty simplistic: every time the " +"*mock* is called, the *read_data* is rewound to the start. If you need more " +"control over the data that you are feeding to the tested code you will need " +"to customize this mock for yourself. When that is insufficient, one of the " +"in-memory filesystem packages on `PyPI `_ can offer a " +"realistic filesystem for testing." msgstr "" #: ../Doc/library/unittest.mock.rst:2124 msgid "" -"Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather than returning it on " -"each call." +"Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " +"The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather " +"than returning it on each call." msgstr "" #: ../Doc/library/unittest.mock.rst:2129 @@ -1515,21 +2020,28 @@ msgid "*read_data* is now reset on each call to the *mock*." msgstr "" #: ../Doc/library/unittest.mock.rst:2132 -msgid "Added :meth:`__iter__` to implementation so that iteration (such as in for loops) correctly consumes *read_data*." +msgid "" +"Added :meth:`__iter__` to implementation so that iteration (such as in for " +"loops) correctly consumes *read_data*." msgstr "" #: ../Doc/library/unittest.mock.rst:2136 -msgid "Using :func:`open` as a context manager is a great way to ensure your file handles are closed properly and is becoming common::" +msgid "" +"Using :func:`open` as a context manager is a great way to ensure your file " +"handles are closed properly and is becoming common::" msgstr "" #: ../Doc/library/unittest.mock.rst:2142 msgid "" -"The issue is that even if you mock out the call to :func:`open` it is the *returned object* that is used as a context manager (and has :meth:`__enter__` and :meth:`__exit__` " -"called)." +"The issue is that even if you mock out the call to :func:`open` it is the " +"*returned object* that is used as a context manager (and has :meth:" +"`__enter__` and :meth:`__exit__` called)." msgstr "" #: ../Doc/library/unittest.mock.rst:2146 -msgid "Mocking context managers with a :class:`MagicMock` is common enough and fiddly enough that a helper function is useful." +msgid "" +"Mocking context managers with a :class:`MagicMock` is common enough and " +"fiddly enough that a helper function is useful." msgstr "" #: ../Doc/library/unittest.mock.rst:2163 @@ -1542,9 +2054,12 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2178 msgid "" -"Autospeccing is based on the existing :attr:`spec` feature of mock. It limits the api of mocks to the api of an original object (the spec), but it is recursive (implemented " -"lazily) so that attributes of mocks only have the same api as the attributes of the spec. In addition mocked functions / methods have the same call signature as the original " -"so they raise a :exc:`TypeError` if they are called incorrectly." +"Autospeccing is based on the existing :attr:`spec` feature of mock. It " +"limits the api of mocks to the api of an original object (the spec), but it " +"is recursive (implemented lazily) so that attributes of mocks only have the " +"same api as the attributes of the spec. In addition mocked functions / " +"methods have the same call signature as the original so they raise a :exc:" +"`TypeError` if they are called incorrectly." msgstr "" #: ../Doc/library/unittest.mock.rst:2185 @@ -1553,19 +2068,24 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2187 msgid "" -":class:`Mock` is a very powerful and flexible object, but it suffers from two flaws when used to mock out objects from a system under test. One of these flaws is specific to " -"the :class:`Mock` api and the other is a more general problem with using mock objects." +":class:`Mock` is a very powerful and flexible object, but it suffers from " +"two flaws when used to mock out objects from a system under test. One of " +"these flaws is specific to the :class:`Mock` api and the other is a more " +"general problem with using mock objects." msgstr "" #: ../Doc/library/unittest.mock.rst:2192 msgid "" -"First the problem specific to :class:`Mock`. :class:`Mock` has two assert methods that are extremely handy: :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with`." +"First the problem specific to :class:`Mock`. :class:`Mock` has two assert " +"methods that are extremely handy: :meth:`~Mock.assert_called_with` and :meth:" +"`~Mock.assert_called_once_with`." msgstr "" #: ../Doc/library/unittest.mock.rst:2205 msgid "" -"Because mocks auto-create attributes on demand, and allow you to call them with arbitrary arguments, if you misspell one of these assert methods then your assertion is gone:" +"Because mocks auto-create attributes on demand, and allow you to call them " +"with arbitrary arguments, if you misspell one of these assert methods then " +"your assertion is gone:" msgstr "" #: ../Doc/library/unittest.mock.rst:2215 @@ -1574,31 +2094,42 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2217 msgid "" -"The second issue is more general to mocking. If you refactor some of your code, rename members and so on, any tests for code that is still using the *old api* but uses mocks " -"instead of the real objects will still pass. This means your tests can all pass even though your code is broken." +"The second issue is more general to mocking. If you refactor some of your " +"code, rename members and so on, any tests for code that is still using the " +"*old api* but uses mocks instead of the real objects will still pass. This " +"means your tests can all pass even though your code is broken." msgstr "" #: ../Doc/library/unittest.mock.rst:2222 msgid "" -"Note that this is another reason why you need integration tests as well as unit tests. Testing everything in isolation is all fine and dandy, but if you don't test how your " -"units are \"wired together\" there is still lots of room for bugs that tests might have caught." +"Note that this is another reason why you need integration tests as well as " +"unit tests. Testing everything in isolation is all fine and dandy, but if " +"you don't test how your units are \"wired together\" there is still lots of " +"room for bugs that tests might have caught." msgstr "" #: ../Doc/library/unittest.mock.rst:2227 msgid "" -":mod:`mock` already provides a feature to help with this, called speccing. If you use a class or instance as the :attr:`spec` for a mock then you can only access attributes " -"on the mock that exist on the real class:" +":mod:`mock` already provides a feature to help with this, called speccing. " +"If you use a class or instance as the :attr:`spec` for a mock then you can " +"only access attributes on the mock that exist on the real class:" msgstr "" #: ../Doc/library/unittest.mock.rst:2238 -msgid "The spec only applies to the mock itself, so we still have the same issue with any methods on the mock:" +msgid "" +"The spec only applies to the mock itself, so we still have the same issue " +"with any methods on the mock:" msgstr "" #: ../Doc/library/unittest.mock.rst:2247 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` function to create a mock " -"with a spec. If you use the ``autospec=True`` argument to :func:`patch` then the object that is being replaced will be used as the spec object. Because the speccing is done " -"\"lazily\" (the spec is created as attributes on the mock are accessed) you can use it with very complex or deeply nested objects (like modules that import modules that " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" +"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"function to create a mock with a spec. If you use the ``autospec=True`` " +"argument to :func:`patch` then the object that is being replaced will be " +"used as the spec object. Because the speccing is done \"lazily\" (the spec " +"is created as attributes on the mock are accessed) you can use it with very " +"complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" @@ -1608,78 +2139,111 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:2266 msgid "" -"You can see that :class:`request.Request` has a spec. :class:`request.Request` takes two arguments in the constructor (one of which is *self*). Here's what happens if we try " -"to call it incorrectly:" +"You can see that :class:`request.Request` has a spec. :class:`request." +"Request` takes two arguments in the constructor (one of which is *self*). " +"Here's what happens if we try to call it incorrectly:" msgstr "" #: ../Doc/library/unittest.mock.rst:2275 -msgid "The spec also applies to instantiated classes (i.e. the return value of specced mocks):" +msgid "" +"The spec also applies to instantiated classes (i.e. the return value of " +"specced mocks):" msgstr "" #: ../Doc/library/unittest.mock.rst:2282 msgid "" -":class:`Request` objects are not callable, so the return value of instantiating our mocked out :class:`request.Request` is a non-callable mock. With the spec in place any " -"typos in our asserts will raise the correct error:" +":class:`Request` objects are not callable, so the return value of " +"instantiating our mocked out :class:`request.Request` is a non-callable " +"mock. With the spec in place any typos in our asserts will raise the correct " +"error:" msgstr "" #: ../Doc/library/unittest.mock.rst:2294 -msgid "In many cases you will just be able to add ``autospec=True`` to your existing :func:`patch` calls and then be protected against bugs due to typos and api changes." +msgid "" +"In many cases you will just be able to add ``autospec=True`` to your " +"existing :func:`patch` calls and then be protected against bugs due to typos " +"and api changes." msgstr "" #: ../Doc/library/unittest.mock.rst:2298 -msgid "As well as using *autospec* through :func:`patch` there is a :func:`create_autospec` for creating autospecced mocks directly:" +msgid "" +"As well as using *autospec* through :func:`patch` there is a :func:" +"`create_autospec` for creating autospecced mocks directly:" msgstr "" #: ../Doc/library/unittest.mock.rst:2306 msgid "" -"This isn't without caveats and limitations however, which is why it is not the default behaviour. In order to know what attributes are available on the spec object, autospec " -"has to introspect (access attributes) the spec. As you traverse attributes on the mock a corresponding traversal of the original object is happening under the hood. If any " -"of your specced objects have properties or descriptors that can trigger code execution then you may not be able to use autospec. On the other hand it is much better to " -"design your objects so that introspection is safe [#]_." +"This isn't without caveats and limitations however, which is why it is not " +"the default behaviour. In order to know what attributes are available on the " +"spec object, autospec has to introspect (access attributes) the spec. As you " +"traverse attributes on the mock a corresponding traversal of the original " +"object is happening under the hood. If any of your specced objects have " +"properties or descriptors that can trigger code execution then you may not " +"be able to use autospec. On the other hand it is much better to design your " +"objects so that introspection is safe [#]_." msgstr "" #: ../Doc/library/unittest.mock.rst:2315 msgid "" -"A more serious problem is that it is common for instance attributes to be created in the :meth:`__init__` method and not to exist on the class at all. *autospec* can't know " -"about any dynamically created attributes and restricts the api to visible attributes." +"A more serious problem is that it is common for instance attributes to be " +"created in the :meth:`__init__` method and not to exist on the class at all. " +"*autospec* can't know about any dynamically created attributes and restricts " +"the api to visible attributes." msgstr "" #: ../Doc/library/unittest.mock.rst:2332 msgid "" -"There are a few different ways of resolving this problem. The easiest, but not necessarily the least annoying, way is to simply set the required attributes on the mock after " -"creation. Just because *autospec* doesn't allow you to fetch attributes that don't exist on the spec it doesn't prevent you setting them:" +"There are a few different ways of resolving this problem. The easiest, but " +"not necessarily the least annoying, way is to simply set the required " +"attributes on the mock after creation. Just because *autospec* doesn't allow " +"you to fetch attributes that don't exist on the spec it doesn't prevent you " +"setting them:" msgstr "" #: ../Doc/library/unittest.mock.rst:2343 msgid "" -"There is a more aggressive version of both *spec* and *autospec* that *does* prevent you setting non-existent attributes. This is useful if you want to ensure your code only " -"*sets* valid attributes too, but obviously it prevents this particular scenario:" +"There is a more aggressive version of both *spec* and *autospec* that *does* " +"prevent you setting non-existent attributes. This is useful if you want to " +"ensure your code only *sets* valid attributes too, but obviously it prevents " +"this particular scenario:" msgstr "" #: ../Doc/library/unittest.mock.rst:2356 msgid "" -"Probably the best way of solving the problem is to add class attributes as default values for instance members initialised in :meth:`__init__`. Note that if you are only " -"setting default attributes in :meth:`__init__` then providing them via class attributes (shared between instances of course) is faster too. e.g." +"Probably the best way of solving the problem is to add class attributes as " +"default values for instance members initialised in :meth:`__init__`. Note " +"that if you are only setting default attributes in :meth:`__init__` then " +"providing them via class attributes (shared between instances of course) is " +"faster too. e.g." msgstr "" #: ../Doc/library/unittest.mock.rst:2366 msgid "" -"This brings up another issue. It is relatively common to provide a default value of ``None`` for members that will later be an object of a different type. ``None`` would be " -"useless as a spec because it wouldn't let you access *any* attributes or methods on it. As ``None`` is *never* going to be useful as a spec, and probably indicates a member " -"that will normally of some other type, autospec doesn't use a spec for members that are set to ``None``. These will just be ordinary mocks (well - MagicMocks):" +"This brings up another issue. It is relatively common to provide a default " +"value of ``None`` for members that will later be an object of a different " +"type. ``None`` would be useless as a spec because it wouldn't let you access " +"*any* attributes or methods on it. As ``None`` is *never* going to be useful " +"as a spec, and probably indicates a member that will normally of some other " +"type, autospec doesn't use a spec for members that are set to ``None``. " +"These will just be ordinary mocks (well - MagicMocks):" msgstr "" #: ../Doc/library/unittest.mock.rst:2381 msgid "" -"If modifying your production classes to add defaults isn't to your liking then there are more options. One of these is simply to use an instance as the spec rather than the " -"class. The other is to create a subclass of the production class and add the defaults to the subclass without affecting the production class. Both of these require you to " -"use an alternative object as the spec. Thankfully :func:`patch` supports this - you can simply pass the alternative object as the *autospec* argument:" +"If modifying your production classes to add defaults isn't to your liking " +"then there are more options. One of these is simply to use an instance as " +"the spec rather than the class. The other is to create a subclass of the " +"production class and add the defaults to the subclass without affecting the " +"production class. Both of these require you to use an alternative object as " +"the spec. Thankfully :func:`patch` supports this - you can simply pass the " +"alternative object as the *autospec* argument:" msgstr "" #: ../Doc/library/unittest.mock.rst:2402 msgid "" -"This only applies to classes or already instantiated objects. Calling a mocked class to create a mock instance *does not* create a real instance. It is only attribute " -"lookups - along with calls to :func:`dir` - that are done." +"This only applies to classes or already instantiated objects. Calling a " +"mocked class to create a mock instance *does not* create a real instance. It " +"is only attribute lookups - along with calls to :func:`dir` - that are done." msgstr "" #: ../Doc/library/unittest.mock.rst:2407 @@ -1687,11 +2251,15 @@ msgid "Sealing mocks" msgstr "" #: ../Doc/library/unittest.mock.rst:2411 -msgid "Seal will disable the automatic creation of mocks when accessing an attribute of the mock being sealed or any of its attributes that are already mocks recursively." +msgid "" +"Seal will disable the automatic creation of mocks when accessing an " +"attribute of the mock being sealed or any of its attributes that are already " +"mocks recursively." msgstr "" #: ../Doc/library/unittest.mock.rst:2414 msgid "" -"If a mock instance with a name or a spec is assigned to an attribute it won't be considered in the sealing chain. This allows one to prevent seal from fixing part of the " -"mock object." +"If a mock instance with a name or a spec is assigned to an attribute it " +"won't be considered in the sealing chain. This allows one to prevent seal " +"from fixing part of the mock object." msgstr "" From a324dd776db7911d4a1134dd858b16929f8dfa4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Tue, 2 Apr 2019 22:30:38 +0200 Subject: [PATCH 03/10] poursuite de la traduction --- library/unittest.mock.po | 62 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 08aeb39a6..ce81ec7b7 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: Python 3.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-03-20 09:03+0100\n" -"PO-Revision-Date: 2019-03-31 12:43+0200\n" +"PO-Revision-Date: 2019-04-02 22:09+0200\n" "Language-Team: FRENCH \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -287,6 +287,8 @@ msgid "" "Create a new :class:`Mock` object. :class:`Mock` takes several optional " "arguments that specify the behaviour of the Mock object:" msgstr "" +"Créer 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 msgid "" @@ -296,6 +298,12 @@ msgid "" "(excluding unsupported magic attributes and methods). Accessing any " "attribute not in this list will raise an :exc:`AttributeError`." msgstr "" +"*spec* : Soit 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înera la levée d'une exception :exc:`AttributeError`." #: ../Doc/library/unittest.mock.rst:215 msgid "" @@ -303,6 +311,9 @@ msgid "" "__class__` returns the class of the spec object. This allows mocks to pass :" "func:`isinstance` tests." 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 msgid "" @@ -310,6 +321,10 @@ msgid "" "get an attribute on the mock that isn't on the object passed as *spec_set* " "will raise an :exc:`AttributeError`." msgstr "" +"*spec_set* : Une variante plus stricte de *spec*. S'il est utilisé, essayer " +"d'utiliser la fonction *set* ou tenter d’accéder à un attribut sur le *mock* " +"qui n'est pas sur l'objet passé comme *spec_set* va lever une exception :exc:" +"`AttributeError`." #: ../Doc/library/unittest.mock.rst:223 msgid "" @@ -319,22 +334,33 @@ msgid "" "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." msgstr "" +"*side_effect* : Une 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 msgid "" "Alternatively *side_effect* can be an exception class or instance. In this " "case the exception will be raised when the mock is called." msgstr "" +"Alternativement *side_effect* peut être une classe ou une instance " +"d'exception. Dans ce cas, l'exception est levée lors de l'appel de l'objet " +"simulé." #: ../Doc/library/unittest.mock.rst:232 msgid "" "If *side_effect* is an iterable then each call to the mock will return the " "next value from the iterable." msgstr "" +"Si *side_effect* est un iterable alors chaque appel au *mock* renvoie la " +"valeur suivante de l'iterable." #: ../Doc/library/unittest.mock.rst:235 msgid "A *side_effect* can be cleared by setting it to ``None``." -msgstr "" +msgstr "Utiliser ``None`` pour remettre à zéro un *side_effect*." #: ../Doc/library/unittest.mock.rst:237 msgid "" @@ -342,6 +368,9 @@ msgid "" "is a new Mock (created on first access). See the :attr:`return_value` " "attribute." msgstr "" +"*valeur_de_retour* : La valeur renvoyée lors de l'appel de l'objet simulée. " +"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 msgid "" @@ -349,6 +378,9 @@ msgid "" "raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to " "these attributes." msgstr "" +"*unsafe* : Par défaut, si un attribut commence par *assert* ou *assret*, une " +"exception :exc:`AttributeError` est généré. Le fait de passer " +"``unsafe=True`` permet d'accéder à ces attributs." #: ../Doc/library/unittest.mock.rst:247 msgid "" @@ -359,18 +391,30 @@ msgid "" "to access an attribute that doesn't exist will raise an :exc:" "`AttributeError`)." msgstr "" +"*wraps* : Élément de l'objet simulée à envelopper. Si *wraps* n'est pas " +"``None``` alors appeler le *Mock* passera l'appel à l'objet enveloppé " +"(renvoyant le résultat réel). L'accès à un attribut sur le *mock* renvoi un " +"objet *Mock* qui enveloppe l'attribut correspondant de l'objet enveloppé " +"(donc essayer d'accéder à un attribut qui n'existe pas va lever une " +"exception :exc:`AttributeError`)." #: ../Doc/library/unittest.mock.rst:254 msgid "" "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." msgstr "" +"Si l'objet simulé a un ensemble explicite de *return_value* alors les appels " +"ne sont pas passés à l'objet enveloppé et c'est *return_value* qui est " +"renvoyée à la place." #: ../Doc/library/unittest.mock.rst:257 msgid "" "*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." 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 msgid "" @@ -378,30 +422,38 @@ msgid "" "used to set attributes on the mock after it is created. See the :meth:" "`configure_mock` method for details." msgstr "" +"Les *mocks* peuvent aussi être appelés avec des arguments de 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 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 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 msgid "" "This method is a convenient way of asserting that calls are made in a " "particular way:" 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 msgid "" "Assert that the mock was called exactly once and that that call was with the " "specified arguments." 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 msgid "assert the mock has been called with the specified arguments." -msgstr "" +msgstr "Asserter que l'objet simulé a été appelé avec les arguments spécifiés." #: ../Doc/library/unittest.mock.rst:323 msgid "" From 3c2667c24b1e6b4af987ebaaf2ad86311b07b355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Wed, 3 Apr 2019 00:01:11 +0200 Subject: [PATCH 04/10] fix pour travis --- library/unittest.mock.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index ce81ec7b7..0db68af57 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: Python 3.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-03-20 09:03+0100\n" -"PO-Revision-Date: 2019-04-02 22:09+0200\n" +"PO-Revision-Date: 2019-04-02 23:51+0200\n" "Language-Team: FRENCH \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -355,8 +355,8 @@ msgid "" "If *side_effect* is an iterable then each call to the mock will return the " "next value from the iterable." msgstr "" -"Si *side_effect* est un iterable alors chaque appel au *mock* renvoie la " -"valeur suivante de l'iterable." +"Si *side_effect* est un itérable alors chaque appel au *mock* renvoie la " +"valeur suivante de l’itérable." #: ../Doc/library/unittest.mock.rst:235 msgid "A *side_effect* can be cleared by setting it to ``None``." @@ -368,7 +368,7 @@ msgid "" "is a new Mock (created on first access). See the :attr:`return_value` " "attribute." msgstr "" -"*valeur_de_retour* : La valeur renvoyée lors de l'appel de l'objet simulée. " +"*return_value* : La valeur renvoyée lors de l'appel de l'objet simulée. " "Par défaut, il s'agit d'un nouveau *Mock* (créé lors du premier accès). Voir " "l'attribut :attr:`return_value`." @@ -391,8 +391,8 @@ msgid "" "to access an attribute that doesn't exist will raise an :exc:" "`AttributeError`)." msgstr "" -"*wraps* : Élément de l'objet simulée à envelopper. Si *wraps* n'est pas " -"``None``` alors appeler le *Mock* passera l'appel à l'objet enveloppé " +"*wraps* : Élément que le simulacre doit envelopper. Si *wraps* n'est pas " +"``None`` alors appeler *Mock* passera l'appel à l'objet enveloppé " "(renvoyant le résultat réel). L'accès à un attribut sur le *mock* renvoi un " "objet *Mock* qui enveloppe l'attribut correspondant de l'objet enveloppé " "(donc essayer d'accéder à un attribut qui n'existe pas va lever une " @@ -441,7 +441,7 @@ msgid "" "particular way:" msgstr "" "Cette méthode est un moyen pratique d'asserter que les appels sont effectués " -"d'une manière particulière :" +"d'une manière particulière ::" #: ../Doc/library/unittest.mock.rst:306 msgid "" @@ -453,7 +453,7 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:321 msgid "assert the mock has been called with the specified arguments." -msgstr "Asserter que l'objet simulé a été appelé avec les arguments spécifiés." +msgstr "Asserter que le simulacre a été appelé avec les arguments spécifiés." #: ../Doc/library/unittest.mock.rst:323 msgid "" From c6aa022023aa3f701a3512fa3d5cde0e8f12d066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Wed, 3 Apr 2019 00:12:09 +0200 Subject: [PATCH 05/10] powrapage --- library/unittest.mock.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 0db68af57..78d3cc8d2 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -368,8 +368,8 @@ msgid "" "is a new Mock (created on first access). See the :attr:`return_value` " "attribute." msgstr "" -"*return_value* : La valeur renvoyée lors de l'appel de l'objet simulée. " -"Par défaut, il s'agit d'un nouveau *Mock* (créé lors du premier accès). Voir " +"*return_value* : La valeur renvoyée lors de l'appel de l'objet simulée. 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 @@ -392,11 +392,11 @@ msgid "" "`AttributeError`)." msgstr "" "*wraps* : Élément que le simulacre doit envelopper. Si *wraps* n'est pas " -"``None`` alors appeler *Mock* passera l'appel à l'objet enveloppé " -"(renvoyant le résultat réel). L'accès à un attribut sur le *mock* renvoi un " -"objet *Mock* qui enveloppe l'attribut correspondant de l'objet enveloppé " -"(donc essayer d'accéder à un attribut qui n'existe pas va lever une " -"exception :exc:`AttributeError`)." +"``None`` alors appeler *Mock* passera l'appel à l'objet enveloppé (renvoyant " +"le résultat réel). L'accès à un attribut sur le *mock* renvoi un objet " +"*Mock* qui enveloppe l'attribut correspondant de l'objet enveloppé (donc " +"essayer d'accéder à un attribut qui n'existe pas va lever une exception :exc:" +"`AttributeError`)." #: ../Doc/library/unittest.mock.rst:254 msgid "" From fbee985b9cae6460a7b1402178a444749a191162 Mon Sep 17 00:00:00 2001 From: Bousquie Pierre Date: Sun, 14 Apr 2019 22:06:30 +0200 Subject: [PATCH 06/10] Apply suggestions from code review Co-Authored-By: Krilivye --- library/unittest.mock.po | 74 ++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 5d9d3a4c1..842e30032 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -18,7 +18,7 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:3 msgid ":mod:`unittest.mock` --- mock object library" -msgstr ":mod:`unittest.mock` --- Bibliothèque d'objets simulacres" +msgstr ":mod:`unittest.mock` — Bibliothèque d'objets simulacres" #: ../Doc/library/unittest.mock.rst:13 msgid "**Source code:** :source:`Lib/unittest/mock.py`" @@ -58,7 +58,7 @@ msgid "" "`patch`." msgstr "" "De plus, *mock* fournit un décorateur :func:`patch` qui est capable de " -"*patcher* les module et les classes dans la portée d'un test, ainsi que :" +"*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`." @@ -71,7 +71,7 @@ msgid "" 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 frameworks d'objets " +"*enregistrement -> rejouer* utilisé par de nombreux cadriciels d'objets " "simulacres." #: ../Doc/library/unittest.mock.rst:37 @@ -96,7 +96,7 @@ 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 renvoie ou limiter les attributs utilisables, puis faire 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 @@ -118,7 +118,7 @@ msgstr "" "comportement. 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 " -"spécifiant lève une :exc:`AttributeError`." +"*spec* lève une :exc:`AttributeError`." #: ../Doc/library/unittest.mock.rst:81 msgid "" @@ -152,7 +152,7 @@ msgid "" "read :ref:`where to patch `." msgstr "" "Avec :func:`patch`, il est important de *patcher* les objets dans l'espace " -"de noms où ils sont recherchés. C'est normalement directe, mais pour un " +"de nommage où ils sont recherchés. C'est ce qui se fait normalement, mais pour un " "guide rapide, lisez :ref:`où patcher `." #: ../Doc/library/unittest.mock.rst:109 @@ -160,7 +160,7 @@ msgid "" "As well as a decorator :func:`patch` can be used as a context manager in a " "with statement:" msgstr "" -"Comme tout décorateur :func:`patch` peut être utilisé comme gestionnaire de " +"Comme tout décorateur, :func:`patch` peut être utilisé comme gestionnaire de " "contexte avec une instruction *with* ::" #: ../Doc/library/unittest.mock.rst:119 @@ -179,7 +179,7 @@ msgid "" "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" -"*Mock* supporte le remplacement des :ref:`méthodes magiques ` " +"*Mock* gère le remplacement des :ref:`méthodes magiques ` " "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 ::" @@ -213,10 +213,10 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"Pour assurer que les objets simulacres dans vos tests ont la même API que " -"les objets qu'ils remplacent. Utiliser :ref:`l'auto-spécification `. L'auto-spécification peut se faire via l'argument *autospec* de " -"patch, ou la fonction :func:`create_autospec`. L'auto-spécification crée des " +"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." @@ -226,8 +226,8 @@ msgid "" "This ensures that your mocks will fail in the same way as your production " "code if they are used incorrectly:" msgstr "" -"Ceci garantit que vos objets simulacres échoueront de la même manière que " -"votre code de production si ils sont utilisées incorrectement ::" +"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 msgid "" @@ -235,7 +235,7 @@ msgid "" "signature of the ``__init__`` method, and on callable objects where it " "copies the signature of the ``__call__`` method." msgstr "" -"La fonction :func:`create_autospec` peut aussi être utilisé sur les classes, " +"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__``." @@ -266,7 +266,7 @@ msgid "" "`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" "La classe :class:`MagicMock` est une sous-classe de :class:`Mock` avec " -"toutes les méthodes magiques pré-créées et prêtes à utiliser. Il existe " +"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`" @@ -279,7 +279,7 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." 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` va créer " +"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`." @@ -288,7 +288,7 @@ msgid "" "Create a new :class:`Mock` object. :class:`Mock` takes several optional " "arguments that specify the behaviour of the Mock object:" msgstr "" -"Créer un nouvel objet :class:`Mock`. :class:`Mock` prend plusieurs arguments " +"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 @@ -299,12 +299,12 @@ msgid "" "(excluding unsupported magic attributes and methods). Accessing any " "attribute not in this list will raise an :exc:`AttributeError`." msgstr "" -"*spec* : Soit une liste de chaînes de caractères ou un objet existant (une " +"*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înera la levée d'une exception :exc:`AttributeError`." +"dans cette liste entraîne la levée d'une exception :exc:`AttributeError`." #: ../Doc/library/unittest.mock.rst:215 msgid "" @@ -322,9 +322,9 @@ msgid "" "get an attribute on the mock that isn't on the object passed as *spec_set* " "will raise an :exc:`AttributeError`." msgstr "" -"*spec_set* : Une variante plus stricte de *spec*. S'il est utilisé, essayer " +"*spec_set* : variante plus stricte de *spec*. S'il est utilisé, essayer " "d'utiliser la fonction *set* ou tenter d’accéder à un attribut sur le *mock* " -"qui n'est pas sur l'objet passé comme *spec_set* va lever une exception :exc:" +"qui n'est pas sur l'objet passé comme *spec_set* lève une exception :exc:" "`AttributeError`." #: ../Doc/library/unittest.mock.rst:223 @@ -335,10 +335,10 @@ msgid "" "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." msgstr "" -"*side_effect* : Une fonction à appeler à chaque fois que le *Mock* est " +"*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 " +"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." @@ -347,9 +347,9 @@ msgid "" "Alternatively *side_effect* can be an exception class or instance. In this " "case the exception will be raised when the mock is called." msgstr "" -"Alternativement *side_effect* peut être une classe ou une instance " +"*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 " -"simulé." +"simulacre." #: ../Doc/library/unittest.mock.rst:232 msgid "" @@ -361,7 +361,7 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:235 msgid "A *side_effect* can be cleared by setting it to ``None``." -msgstr "Utiliser ``None`` pour remettre à zéro un *side_effect*." +msgstr "Utilisez ``None`` pour remettre à zéro un *side_effect*." #: ../Doc/library/unittest.mock.rst:237 msgid "" @@ -369,7 +369,7 @@ msgid "" "is a new Mock (created on first access). See the :attr:`return_value` " "attribute." msgstr "" -"*return_value* : La valeur renvoyée lors de l'appel de l'objet simulée. Par " +"*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`." @@ -379,8 +379,8 @@ msgid "" "raise an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to " "these attributes." msgstr "" -"*unsafe* : Par défaut, si un attribut commence par *assert* ou *assret*, une " -"exception :exc:`AttributeError` est généré. Le fait de passer " +"*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 @@ -392,11 +392,11 @@ msgid "" "to access an attribute that doesn't exist will raise an :exc:" "`AttributeError`)." msgstr "" -"*wraps* : Élément que le simulacre doit envelopper. Si *wraps* n'est pas " -"``None`` alors appeler *Mock* passera l'appel à l'objet enveloppé (renvoyant " -"le résultat réel). L'accès à un attribut sur le *mock* renvoi un objet " -"*Mock* qui enveloppe l'attribut correspondant de l'objet enveloppé (donc " -"essayer d'accéder à un attribut qui n'existe pas va lever une exception :exc:" +"*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 @@ -404,8 +404,8 @@ msgid "" "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." msgstr "" -"Si l'objet simulé a un ensemble explicite de *return_value* alors les appels " -"ne sont pas passés à l'objet enveloppé et c'est *return_value* qui est " +"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 @@ -423,7 +423,7 @@ msgid "" "used to set attributes on the mock after it is created. See the :meth:" "`configure_mock` method for details." msgstr "" -"Les *mocks* peuvent aussi être appelés avec des arguments de mots-clés " +"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." From bfdee7f538fd79e763699a6e73366afb3e61c1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Sun, 14 Apr 2019 22:42:33 +0200 Subject: [PATCH 07/10] Powrapage et correction sur revue de christophe. --- library/unittest.mock.po | 79 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 842e30032..437fb5d65 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -114,10 +114,10 @@ msgid "" "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`." msgstr "" -"*Mock* a beaucoup d'autres façons de configurer et de contrôler son " -"comportement. 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 " +"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 @@ -152,8 +152,8 @@ msgid "" "read :ref:`where to patch `." 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 `." +"de nommage où ils sont recherchés. C'est ce qui se fait normalement, mais " +"pour un guide rapide, lisez :ref:`où patcher `." #: ../Doc/library/unittest.mock.rst:109 msgid "" @@ -179,8 +179,8 @@ msgid "" "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" -"*Mock* gère le remplacement des :ref:`méthodes magiques ` " -"de Python. La façon la plus simple d'utiliser les méthodes magiques est la " +"*Mock* gère le remplacement des :ref:`méthodes magiques ` 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 @@ -216,8 +216,8 @@ 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 `. 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 " +"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." @@ -235,9 +235,9 @@ msgid "" "signature of the ``__init__`` method, and on callable objects where it " "copies the signature of the ``__call__`` method." 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__``." +"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 msgid "The Mock Class" @@ -252,11 +252,11 @@ msgid "" "allowing you to make assertions about what your code has done to them." msgstr "" "La classe :class:`Mock` est un objet simulacre flexible destiné à remplacer " -"l'utilisation d'objets bouchonnés 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." +"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 msgid "" @@ -279,9 +279,9 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." 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`." +"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 msgid "" @@ -299,9 +299,9 @@ msgid "" "(excluding unsupported magic attributes and methods). Accessing any " "attribute not in this list will raise an :exc:`AttributeError`." 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 " +"*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`." @@ -335,11 +335,11 @@ msgid "" "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." 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 " +"*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 @@ -347,9 +347,8 @@ msgid "" "Alternatively *side_effect* can be an exception class or instance. In this " "case the exception will be raised when the mock is called." 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." +"*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 msgid "" @@ -380,8 +379,8 @@ msgid "" "these attributes." 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." +"exception :exc:`AttributeError` est levée. Le fait de passer ``unsafe=True`` " +"permet d'accéder à ces attributs." #: ../Doc/library/unittest.mock.rst:247 msgid "" @@ -393,10 +392,10 @@ msgid "" "`AttributeError`)." 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:" +"``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 @@ -404,8 +403,8 @@ msgid "" "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." 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 " +"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 From 5c628bb7cfd2deedabc99787f65618ba93116a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Mon, 15 Apr 2019 23:38:04 +0200 Subject: [PATCH 08/10] =?UTF-8?q?Poursuite=20de=20la=20traduction:=20m?= =?UTF-8?q?=C3=A9thodes=20de=20mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/unittest.mock.po | 61 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 437fb5d65..5d4715d56 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -5,16 +5,15 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.6\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2019-04-02 23:51+0200\n" +"PO-Revision-Date: 2019-04-15 23:25+0200\n" "POT-Creation-Date: 2019-04-10 09:35+0200\n" -"Last-Translator: FULL NAME \n" "Language-Team: FRENCH \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Last-Translator: Bousquié Pierre \n" "X-Generator: Poedit 2.2.1\n" +"Last-Translator: Bousquié Pierre \n" #: ../Doc/library/unittest.mock.rst:3 msgid ":mod:`unittest.mock` --- mock object library" @@ -462,36 +461,50 @@ msgid "" "the call is the most recent one, and in the case of :meth:" "`assert_called_once_with` it must also be the only call." 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 msgid "" "assert the mock has been called with the specified calls. The :attr:" "`mock_calls` list is checked for the calls." 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 msgid "" "If *any_order* is false (the default) then the calls must be sequential. " "There can be extra calls before or after the specified calls." 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 msgid "" "If *any_order* is true then the calls can be in any order, but they must all " "appear in :attr:`mock_calls`." 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 msgid "Assert the mock was never called." -msgstr "" +msgstr "Asserter que le simulacre n'a jamais été appelé." #: ../Doc/library/unittest.mock.rst:373 msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "" +"La méthode *reset_mock* réinitialise tous les attributs d'appel sur un " +"simulacre :" #: ../Doc/library/unittest.mock.rst:383 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 msgid "" @@ -502,20 +515,34 @@ msgid "" "`side_effect`, then pass the corresponding parameter as ``True``. Child " "mocks and the return value mock (if any) are reset as well." 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 msgid "*return_value*, and :attr:`side_effect` are keyword only argument." msgstr "" +"*return_value*, et :attr:`side_effect` sont utilisable uniquement par " +"arguments nommés." #: ../Doc/library/unittest.mock.rst:400 msgid "" "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." 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 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "" +"Si *spec_set* est vrai, seuls les attributs de la spécification peuvent être " +"définis." #: ../Doc/library/unittest.mock.rst:409 msgid "" @@ -523,26 +550,37 @@ msgid "" "Calls to the attached mock will be recorded in the :attr:`method_calls` and :" "attr:`mock_calls` attributes of this one." 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 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 msgid "" "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:" 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 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "" +"La même chose peut être réalisée en utilisant le constructeur des " +"simulacres :" #: ../Doc/library/unittest.mock.rst:445 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" +":meth:`configure_mock` existe pour faciliter la configuration après la " +"création du simulacre." #: ../Doc/library/unittest.mock.rst:451 msgid "" @@ -550,12 +588,17 @@ msgid "" "results. For mocks with a *spec* this includes all the permitted attributes " "for the mock." 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 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "" +"Voir :data:`FILTER_DIR` pour savoir ce que fait ce filtrage, et comment le " +"désactiver." #: ../Doc/library/unittest.mock.rst:461 msgid "" @@ -563,12 +606,18 @@ msgid "" "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." msgstr "" +"Créez les simulacres enfant pour les attributs et la valeur de retour. Par " +"défaut, les objets simulacre enfants seront du même type que le parent. Les " +"sous-classes de *Mock* peuvent surcharger cette méthode pour personnaliser " +"la façon dont les simulacre enfants sont créés." #: ../Doc/library/unittest.mock.rst:466 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." 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 msgid "A boolean representing whether or not the mock object has been called:" From 897134755aa7fe2463b8bc74e31ba6d6756de03a Mon Sep 17 00:00:00 2001 From: Christophe Nanteuil <35002064+christopheNan@users.noreply.github.com> Date: Sun, 21 Apr 2019 12:34:53 +0200 Subject: [PATCH 09/10] Apply suggestions from code review Co-Authored-By: Krilivye --- library/unittest.mock.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 5d4715d56..6a9c6952e 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -606,10 +606,10 @@ msgid "" "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." msgstr "" -"Créez les simulacres enfant pour les attributs et la valeur de retour. Par " -"défaut, les objets simulacre enfants seront du même type que le parent. Les " +"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 simulacre enfants sont créés." +"la façon dont les simulacres enfants sont créés." #: ../Doc/library/unittest.mock.rst:466 msgid "" From 839734d1b1e3d073d84216c2d31bcea90e46e668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bousqui=C3=A9?= Date: Mon, 22 Apr 2019 12:26:37 +0200 Subject: [PATCH 10/10] Poursuite de la traduction! --- library/unittest.mock.po | 43 ++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 6a9c6952e..5ec3157ba 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.6\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2019-04-15 23:25+0200\n" +"PO-Revision-Date: 2019-04-22 12:07+0200\n" "POT-Creation-Date: 2019-04-10 09:35+0200\n" "Language-Team: FRENCH \n" "Language: fr\n" @@ -621,31 +621,38 @@ msgstr "" #: ../Doc/library/unittest.mock.rst:472 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 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 msgid "Set this to configure the value returned by calling the mock:" msgstr "" +"Définir cette option pour configurer la valeur renvoyé par appel du " +"simulacre :" #: ../Doc/library/unittest.mock.rst:503 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "" +"La valeur de revoie par défaut est un simulacre configurable normalement :" #: ../Doc/library/unittest.mock.rst:512 msgid ":attr:`return_value` can also be set in the constructor:" msgstr "" +"L'attribut :attr:`return_value` peut également être défini dans le " +"constructeur :" #: ../Doc/library/unittest.mock.rst:523 msgid "" "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." 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 msgid "" @@ -655,6 +662,11 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." 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 msgid "" @@ -663,30 +675,39 @@ msgid "" "to be raised, or a value to be returned from the call to the mock (:data:" "`DEFAULT` handling is identical to the function case)." 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 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" 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 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 msgid "Using a callable:" -msgstr "" +msgstr "Utilisation d'un objet appelable :" #: ../Doc/library/unittest.mock.rst:564 msgid "" ":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:" 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 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 msgid "" @@ -696,6 +717,11 @@ msgid "" "tuple) and the second member is any keyword arguments (or an empty " "dictionary)." 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 msgid "" @@ -704,6 +730,11 @@ msgid "" "are tuples, so they can be unpacked to get at the individual arguments and " "make more complex assertions. See :ref:`calls as tuples `." 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 `." #: ../Doc/library/unittest.mock.rst:620 msgid ""