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

Warn when passing *strategies* as elements to sampled_from (rather than to one_of)? #3819

Closed
vreuter opened this issue Dec 20, 2023 · 0 comments · Fixed by #3820
Closed

Warn when passing *strategies* as elements to sampled_from (rather than to one_of)? #3819

vreuter opened this issue Dec 20, 2023 · 0 comments · Fixed by #3820
Labels
legibility make errors helpful and Hypothesis grokable

Comments

@vreuter
Copy link
Contributor

vreuter commented Dec 20, 2023

I was just making an error passing values of strategy type to the elements parameter of sampled_from when what I should've been using was one_of. This gave me some initially unexpected results, as I was dealing in the body of my test case with values of strategy type than rather than the values I expected to be generated from them.

What do you think about a warning message or an error when passing strategies as elements to sampled_from? Naively, it seems like this would more often be in error (mis/incomplete understanding of the API, confusing sampled_from and one_of) than in intention.

Regardless, thanks for a great library!

@vreuter vreuter changed the title Warn when passing strategies as elements to sampled_from (rather than to one_of)? Warn when passing strategies as elements to sampled_from (rather than to one_of)? Dec 20, 2023
@vreuter vreuter changed the title Warn when passing strategies as elements to sampled_from (rather than to one_of)? Warn when passing _strategies_ as elements to sampled_from (rather than to one_of)? Dec 20, 2023
@vreuter vreuter changed the title Warn when passing _strategies_ as elements to sampled_from (rather than to one_of)? Warn when passing *strategies* as elements to sampled_from (rather than to one_of)? Dec 20, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 22, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 22, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 22, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 22, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 22, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 22, 2023
@Zac-HD Zac-HD added the legibility make errors helpful and Hypothesis grokable label Dec 22, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 26, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 26, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 26, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 29, 2023
vreuter added a commit to vreuter/hypothesis that referenced this issue Dec 31, 2023
Zac-HD pushed a commit to vreuter/hypothesis that referenced this issue Jan 8, 2024
Zac-HD pushed a commit to vreuter/hypothesis that referenced this issue Jan 8, 2024
Zac-HD pushed a commit to vreuter/hypothesis that referenced this issue Jan 8, 2024
Zac-HD pushed a commit to vreuter/hypothesis that referenced this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legibility make errors helpful and Hypothesis grokable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants