[Python-checkins] cpython (3.3): Closes #17109: fix heading levels in mock doc.
georg.brandl
python-checkins at python.org
Sun Feb 3 11:47:34 CET 2013
http://hg.python.org/cpython/rev/72aee7ee2299
changeset: 81963:72aee7ee2299
branch: 3.3
parent: 81961:3febccf2a756
user: Georg Brandl <georg at python.org>
date: Sun Feb 03 11:47:49 2013 +0100
summary:
Closes #17109: fix heading levels in mock doc.
files:
Doc/library/unittest.mock.rst | 45 +++++++++++-----------
1 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -926,7 +926,7 @@
The patchers
-============
+------------
The patch decorators are used for patching objects only within the scope of
the function they decorate. They automatically handle the unpatching for you,
@@ -935,7 +935,7 @@
patch
------
+~~~~~
.. note::
@@ -1108,7 +1108,7 @@
patch.object
-------------
+~~~~~~~~~~~~
.. function:: patch.object(target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)
@@ -1144,7 +1144,7 @@
patch.dict
-----------
+~~~~~~~~~~
.. function:: patch.dict(in_dict, values=(), clear=False, **kwargs)
@@ -1227,7 +1227,7 @@
patch.multiple
---------------
+~~~~~~~~~~~~~~
.. function:: patch.multiple(target, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)
@@ -1291,7 +1291,7 @@
.. _start-and-stop:
patch methods: start and stop
------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All the patchers have `start` and `stop` methods. These make it simpler to do
patching in `setUp` methods or where you want to do multiple patches without
@@ -1364,7 +1364,7 @@
TEST_PREFIX
------------
+~~~~~~~~~~~
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
@@ -1394,7 +1394,7 @@
Nesting Patch Decorators
-------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~
If you want to perform multiple patches then you can simply stack up the
decorators.
@@ -1423,7 +1423,7 @@
.. _where-to-patch:
Where to patch
---------------
+~~~~~~~~~~~~~~
`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
@@ -1465,7 +1465,7 @@
Patching Descriptors and Proxy Objects
---------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Both patch_ and patch.object_ correctly patch and restore descriptors: class
methods, static methods and properties. You should patch these on the *class*
@@ -1475,12 +1475,12 @@
MagicMock and magic method support
-==================================
+----------------------------------
.. _magic-methods:
Mocking Magic Methods
----------------------
+~~~~~~~~~~~~~~~~~~~~~
:class:`Mock` supports mocking the Python protocol methods, also known as
"magic methods". This allows mock objects to replace containers or other
@@ -1566,7 +1566,7 @@
Magic Mock
-----------
+~~~~~~~~~~
There are two `MagicMock` variants: `MagicMock` and `NonCallableMagicMock`.
@@ -1695,10 +1695,10 @@
Helpers
-=======
+-------
sentinel
---------
+~~~~~~~~
.. data:: sentinel
@@ -1726,7 +1726,7 @@
DEFAULT
--------
+~~~~~~~
.. data:: DEFAULT
@@ -1736,9 +1736,8 @@
functions to indicate that the normal return value should be used.
-
call
-----
+~~~~
.. function:: call(*args, **kwargs)
@@ -1827,7 +1826,7 @@
create_autospec
----------------
+~~~~~~~~~~~~~~~
.. function:: create_autospec(spec, spec_set=False, instance=False, **kwargs)
@@ -1854,7 +1853,7 @@
ANY
----
+~~~
.. data:: ANY
@@ -1885,7 +1884,7 @@
FILTER_DIR
-----------
+~~~~~~~~~~
.. data:: FILTER_DIR
@@ -1940,7 +1939,7 @@
mock_open
----------
+~~~~~~~~~
.. function:: mock_open(mock=None, read_data=None)
@@ -1994,7 +1993,7 @@
.. _auto-speccing:
Autospeccing
-------------
+~~~~~~~~~~~~
Autospeccing is based on the existing `spec` feature of mock. It limits the
api of mocks to the api of an original object (the spec), but it is recursive
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list