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
Add dates() and times() strategies to hypothesis.extra.datetime #160
Conversation
|
Generally pretty strongly in favour of this feature, and assuming the build passes mostly looks good, thanks! I'll add some specific comments inline though. |
| @@ -276,6 +276,30 @@ def datetimes(allow_naive=None, timezones=None, min_year=None, max_year=None): | |||
| ) | |||
|
|
|||
|
|
|||
| def dates(min_year=None, max_year=None): | |||
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.
hypothesis.strategies has a 'defines_strategy' decorator that should be used here that fixes up the repr of the returned strategy to correspond to the function that generates it. This should be used here and on times.
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.
(I've just noticed I'm not using it on datetimes. I'll fix that)
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.
Done!
|
LGTM. Will wait for the build and then assuming everything goes according to plan shall merge. |
|
Ah, you've failed the linter. If you run tox -e lint locally this will fix up most of the errors. |
|
The pypy segfault is not your fault and you should ignore it. Something I've done recently is triggering an intermittent pypy segfault. This is sadly a thing that happens. |
|
Also you might want to rebase this against master, as there have been a few changes (one of which affects datetime). |
a20c183
to
b4c240b
Compare
|
Linting and rebasing done. |
|
Sorry, one final thing: You should add yourself to the list of contributors in CONTRIBUTING.rst :-) |
b4c240b
to
c70916c
Compare
|
You now have TWO Adam Johnsons as contributors - suspicious... |
|
Sorry, I said "finally" and then the build failed. :-( The appveyor one is my fault (oops. Fixing now). The coverage one is I think you (not the strings case, which I've never seen fail before but looks like it can happen with very very low probability), but the datetimes one you haven't tested your argument validation for times(). One option there would be to just use the existing datetimes() function and inherit the argument validation from it rather than having to write your own. |
c70916c
to
c717e4f
Compare
Add dates() and times() strategies to hypothesis.extra.datetime
|
Sorry, I missed the final fix on this had happened. Thanks again for the feature! |
|
|
datesandtimesstrategiesdatetimesdocumentationlivehtmltarget todocs/Makefileusingsphinx-autobuildfor live docs editinggitignoreupdate with some folders that appear during tests