]> granicus.if.org Git - python/commitdiff
Closes #17109: fix heading levels in mock doc.
authorGeorg Brandl <georg@python.org>
Sun, 3 Feb 2013 10:47:49 +0000 (11:47 +0100)
committerGeorg Brandl <georg@python.org>
Sun, 3 Feb 2013 10:47:49 +0000 (11:47 +0100)
Doc/library/unittest.mock.rst

index 8e72696f56a720e23c138605ff12684397f1e6bc..97e595d2cd994d287f7bb35477c90e47e3831398 100644 (file)
@@ -926,7 +926,7 @@ method:
 
 
 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 @@ statements or as class decorators.
 
 
 patch
------
+~~~~~
 
 .. note::
 
@@ -1108,7 +1108,7 @@ into a `patch` call using `**`:
 
 
 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 @@ meaning as they do for `patch`.
 
 
 patch.dict
-----------
+~~~~~~~~~~
 
 .. function:: patch.dict(in_dict, values=(), clear=False, **kwargs)
 
@@ -1227,7 +1227,7 @@ magic methods `__getitem__`, `__setitem__`, `__delitem__` and either
 
 
 patch.multiple
---------------
+~~~~~~~~~~~~~~
 
 .. function:: patch.multiple(target, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)
 
@@ -1291,7 +1291,7 @@ context manger is a dictionary where created mocks are keyed by name:
 .. _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 @@ It is also possible to stop all patches which have been started by using
 
 
 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 @@ inform the patchers of the different prefix by setting `patch.TEST_PREFIX`:
 
 
 Nesting Patch Decorators
-------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~
 
 If you want to perform multiple patches then you can simply stack up the
 decorators.
@@ -1423,7 +1423,7 @@ passed into your test function matches this order.
 .. _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 @@ being looked up on the a module and so we have to patch `a.SomeClass` instead::
 
 
 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 @@ that proxy attribute access, like the `django setttings object
 
 
 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 @@ by mock, can't be set dynamically, or can cause problems:
 
 
 Magic Mock
-----------
+~~~~~~~~~~
 
 There are two `MagicMock` variants: `MagicMock` and `NonCallableMagicMock`.
 
@@ -1695,10 +1695,10 @@ Magic methods that are supported but not setup by default in ``MagicMock`` are:
 
 
 Helpers
-=======
+-------
 
 sentinel
---------
+~~~~~~~~
 
 .. data:: sentinel
 
@@ -1726,7 +1726,7 @@ In this example we monkey patch `method` to return `sentinel.some_object`:
 
 
 DEFAULT
--------
+~~~~~~~
 
 
 .. data:: DEFAULT
@@ -1736,9 +1736,8 @@ DEFAULT
     functions to indicate that the normal return value should be used.
 
 
-
 call
-----
+~~~~
 
 .. function:: call(*args, **kwargs)
 
@@ -1827,7 +1826,7 @@ arguments are a dictionary:
 
 
 create_autospec
----------------
+~~~~~~~~~~~~~~~
 
 .. function:: create_autospec(spec, spec_set=False, instance=False, **kwargs)
 
@@ -1854,7 +1853,7 @@ See :ref:`auto-speccing` for examples of how to use auto-speccing with
 
 
 ANY
----
+~~~
 
 .. data:: ANY
 
@@ -1885,7 +1884,7 @@ passed in.
 
 
 FILTER_DIR
-----------
+~~~~~~~~~~
 
 .. data:: FILTER_DIR
 
@@ -1940,7 +1939,7 @@ Alternatively you can just use `vars(my_mock)` (instance members) and
 
 
 mock_open
----------
+~~~~~~~~~
 
 .. function:: mock_open(mock=None, read_data=None)
 
@@ -1994,7 +1993,7 @@ And for reading files:
 .. _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