New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement BaseQuerySet.batch_size #1426
Conversation
Perhaps, it would be good if the docstring would link to pymongo - it isn't very informative yet. |
dac5f37
to
34ba527
Compare
Thanks @gukoff , good point! |
|
||
# test invalid batch size | ||
qs = A.objects.batch_size(-1) | ||
self.assertRaises(ValueError, lambda: list(qs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda looks like a workaround here. How about:
with self.assertRaises(ValueError):
list(qs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gukoff that won't work for Python 2.6 (which we still support). Thanks though, it was a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could be done is self.assertRaises(ValueError, list, qs)
, but personally I don't find that more readable/less hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that won't work for Python 2.6 (which we still support)
Thanks, I didn't know about this.
d899b7a
to
34ba527
Compare
Fixes #1244