Skip to content

Conversation

@clarete
Copy link

@clarete clarete commented Nov 18, 2013

The method mock.assert_called_with() does not exist. However, missing
methods on mocks always return True. To fix that, the call_args_list
attribute of the mock was used in the assertion instead.

The method `mock.assert_called_with()` does not exist. However, missing methods on mocks always return True. To fix that, the `call_args_list` attribute of the mock was used in the assertion instead.
@Julian
Copy link
Member

Julian commented Nov 18, 2013

It exists :)

assert_called_once_with is assert_called_with + assert call count is one.

@clarete
Copy link
Author

clarete commented Nov 18, 2013

Hmm, thanks for the heads up. I ran the tests with more than two calls and it didn't break! Should I keep the PR but change the message?

@clarete
Copy link
Author

clarete commented Nov 18, 2013

Feel free to just close it if you think it doesn't make sense, though :)

@Julian
Copy link
Member

Julian commented Nov 18, 2013

No you're right :), we could tighten that test up by splitting up the two cases there, which really are two distinct things. I.e. https://github.com/Julian/jsonschema/pull/137/files#diff-523a4ebdb045b5a1613d6711add86c7fR48 is really one test case, and then the second one involves when there are errors returned by the validator.

If we did that, we'd only see it being called once (the reason you see twice, and that we had to use assert_called_with rather than assert_called_once_with is because we called iter_errors twice there).

So yeah I'd be fine with that, if we split that into a test about iter_errors_empty and iter_errors_with_errors.

@Julian Julian closed this in eb557da Dec 8, 2013
@Julian Julian reopened this Dec 8, 2013
@Julian Julian closed this Dec 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants