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
Missing argument validation for rule()
#2149
Comments
If no one minds, I think I'll take a look at this. :) |
@Zac-HD,
How do we know what types to compare against? Do we need to somehow extract the usage of kwargs from f?
In both cases (Settings, RuleBasedStateMachine), the check_type is against a locally created object. This is not the case with kwargs.
I couldn't find this in other PRs, do you have an example? Thanks in advance |
Hey @NNRepos - I hope you're enjoying Hypothesis Here's a good example of a pull request including contributors entry, release file, change, and tests! |
Hey @fragmad, any progress? Happy to give you some tips or help out if you're stuck |
Hey @Zac-HD, I'm also new to hypothesis and would like to help contribute if this issue is still open. I was hoping you could clarify something for me. It looks like both Thanks! |
Hey @benjpalmer - welcome! We'll reserve this issue for you for a week; after that anyone else can open a PR
The validation for for k, v in kwargs.items():
check_type(SearchStrategy, v, k) plus tests, a changelog, and your name in the authors list |
I was playing around with stateful testing earlier today, and messed up a function call. Here's the problem: this caused an internal error instead of a validation error with a nice message!
hypothesis.stateful.rule()
, andinitialize()
, should usecheck_type
to validate the types of all their arguments. There are examples of this usage elsewhere in the module, though you'll need to loop overkwargs.items()
to get the argument names.Then add tests to
hypothesis-python/tests/cover/test_argument_validation.py
, a minor release by creatinghypothesis-python/RELEASE.rst
(check the other open PRs for examples), and you'll be good to go!You're welcome to check for other cases of missing validation, and we'd love fixes for them, but we would encourage that to happen in follow-up PRs. Better to merge small changes regularly than have them build up and get stuck!
The text was updated successfully, but these errors were encountered: