You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the following examples. In both cases the mocked function gets called by the tested code.
self.mock_callable(
mock_service, "func"
).for_call(expected_request).to_return_value(None).and_assert_called_once()
# passes, all good
self.mock_callable(
mock_service, "func"
).for_call(expected_request).and_assert_called_once()
# error: UnexpectedCallReceived: <StrictMock ...>, 'function_name': Excepted not to be called!
I'm not sure if omitting to_return_value should be allowed or not, but it looks like the error message is a bit detached from the expectations anyway. The error message says Excepted not to be called! when clearly I have an .and_assert_called_once().
(Btw I just noticed there is a typo in the error message Excepted -> Expected.)
The text was updated successfully, but these errors were encountered:
you are telling the mock to accept a specific call, but not telling it what to do when this call is made. In this case, using and_assert_called_once() makes little sense, as the test would never pass, as the call can never succeed.
See the following examples. In both cases the mocked function gets called by the tested code.
I'm not sure if omitting
to_return_value
should be allowed or not, but it looks like the error message is a bit detached from the expectations anyway. The error message saysExcepted not to be called!
when clearly I have an.and_assert_called_once()
.(Btw I just noticed there is a typo in the error message
Excepted
->Expected
.)The text was updated successfully, but these errors were encountered: