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

Deprecate use of @given() inside @given() #4167

Open
Zac-HD opened this issue Nov 10, 2024 · 0 comments
Open

Deprecate use of @given() inside @given() #4167

Zac-HD opened this issue Nov 10, 2024 · 0 comments
Labels
legibility make errors helpful and Hypothesis grokable performance go faster! use less memory!

Comments

@Zac-HD
Copy link
Member

Zac-HD commented Nov 10, 2024

Nesting @given() inside @given() might seem reasonable at first glance - but there are major problems, and it doesn't actually give you any more power than using st.data() instead of an inner function. Those downsides include quadratic cost of generating examples, and considerably worse when shrinking; and outright incompatibility with some alternative backends.

@tybug checked a github dataset, and there are only five cases across thousands of repos: one in each of ArielHorwitz/botroyale, chardet/chardet, and cgarciae/pypeln, and vyperlang/vyper has these two.

So let's detect this, emit a deprecation warning - which can explain how and why to use st.data() instead - and then we'll turn that into an error in the next major version.

@Zac-HD Zac-HD added performance go faster! use less memory! legibility make errors helpful and Hypothesis grokable labels Nov 10, 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 performance go faster! use less memory!
Projects
None yet
Development

No branches or pull requests

1 participant