Merge with 3.3

This commit is contained in:
Terry Jan Reedy 2014-01-21 00:02:17 -05:00
commit a67a79da24

View file

@ -476,7 +476,7 @@ the `backend` attribute on a `Something` instance. In this particular case
we are only interested in the return value from the final call to we are only interested in the return value from the final call to
`start_call` so we don't have much configuration to do. Let's assume the `start_call` so we don't have much configuration to do. Let's assume the
object it returns is 'file-like', so we'll ensure that our response object object it returns is 'file-like', so we'll ensure that our response object
uses the builtin `file` as its `spec`. uses the builtin `open` as its `spec`.
To do this we create a mock instance as our mock backend and create a mock To do this we create a mock instance as our mock backend and create a mock
response object for it. To set the response as the return value for that final response object for it. To set the response as the return value for that final
@ -488,7 +488,7 @@ We can do that in a slightly nicer way using the :meth:`~Mock.configure_mock`
method to directly set the return value for us: method to directly set the return value for us:
>>> something = Something() >>> something = Something()
>>> mock_response = Mock(spec=file) >>> mock_response = Mock(spec=open)
>>> mock_backend = Mock() >>> mock_backend = Mock()
>>> config = {'get_endpoint.return_value.create_call.return_value.start_call.return_value': mock_response} >>> config = {'get_endpoint.return_value.create_call.return_value.start_call.return_value': mock_response}
>>> mock_backend.configure_mock(**config) >>> mock_backend.configure_mock(**config)