Skip to content

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

Open
@Zac-HD

Description

@Zac-HD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    legibilitymake errors helpful and Hypothesis grokableperformancego faster! use less memory!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions