Skip to content
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

Merged
merged 3 commits into from Dec 6, 2016
Merged

Implement BaseQuerySet.batch_size #1426

merged 3 commits into from Dec 6, 2016

Conversation

wojcikstefan
Copy link
Member

Fixes #1244

@gukoff
Copy link
Contributor

gukoff commented Dec 5, 2016

Perhaps, it would be good if the docstring would link to pymongo - it isn't very informative yet.

@wojcikstefan
Copy link
Member Author

Thanks @gukoff , good point!


# test invalid batch size
qs = A.objects.batch_size(-1)
self.assertRaises(ValueError, lambda: list(qs))
Copy link
Contributor

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)

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants