diff options
-rw-r--r-- | docs/helpers.txt | 6 | ||||
-rw-r--r-- | docs/mock.txt | 4 | ||||
-rw-r--r-- | docs/mocksignature.txt | 5 | ||||
-rw-r--r-- | mock.py | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/docs/helpers.txt b/docs/helpers.txt index b0fa867..b90a289 100644 --- a/docs/helpers.txt +++ b/docs/helpers.txt @@ -97,6 +97,10 @@ arguments are a dictionary: (1, 2, 3) >>> kwargs {'arg2': 'two', 'arg': 'one'} + >>> args is kall[0] + True + >>> kwargs is kall[1] + True >>> m = MagicMock() >>> m.foo(4, 5, 6, arg='two', arg2='three') @@ -109,6 +113,8 @@ arguments are a dictionary: (4, 5, 6) >>> kwargs {'arg2': 'three', 'arg': 'two'} + >>> name is m.mock_calls[0][0] + True create_autospec diff --git a/docs/mock.txt b/docs/mock.txt index d388e5f..d064148 100644 --- a/docs/mock.txt +++ b/docs/mock.txt @@ -182,11 +182,11 @@ the `new_callable` argument to `patch`. .. method:: mock_add_spec(spec, spec_set=False) - Mock.Add a spec to a mock. `spec` can either be an object or a + 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. - If `spec_set` is True then only attributes on the spec can be set. + If `spec_set` is `True` then only attributes on the spec can be set. .. method:: attach_mock(mock, attribute) diff --git a/docs/mocksignature.txt b/docs/mocksignature.txt index ce7c2df..e53bfa3 100644 --- a/docs/mocksignature.txt +++ b/docs/mocksignature.txt @@ -3,6 +3,11 @@ mocksignature .. currentmodule:: mock +.. note:: + + :ref:`auto-speccing`, added in mock 0.8, is a more advanced version of + `mocksignature` and can be used for many of the same use cases. + A problem with using mock objects to replace real objects in your tests is that :class:`Mock` can be *too* flexible. Your code can treat the mock objects in any way and you have to manually check that they were called correctly. If your @@ -29,7 +29,7 @@ __all__ = ( ) -__version__ = '0.8.0rc2' +__version__ = '0.8.0' import pprint |