-
Notifications
You must be signed in to change notification settings - Fork 586
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
stateful testing prints undefined variables #2139
Comments
|
AFAICT the problem is that |
|
One solution would be to have several variables assigned if a rule returns A disadvantage of this is that if a large number of results are returned then we get an unwieldy selection of variables. An alternative could be to allow The disadvantage of this is that the implementation would be more complicated because the state machine would need to keep track of |
Yup, that's definitely it. Thanks for the bug report! Changing the definition of |
This isn't necessarily as much of an issue as you might be imagining. Internally variable names are just strings, so there's no difficulty in principle with naming one For maximum readability at the cost of a slightly more fiddly implementation (we do that a lot...) we could even switch between the two. e.g. if three or fewer results are returned, unpack it, if more than that are returned use indexing. ETA: We could also not worry about it and just unpack them all actually. Generally what will happen (I think) is that the multiple will be hand-written and thus not too long or generated and thus will tend to get smaller during shrinking so should have a feasible number of variables. |
The Problem
When stateful prints a falsifying example sometimes the example contains variables that are not defined. This means that one cannot simply copy/paste the example into a Python shell to reproduce it.
Example
Running the above test (with
pytest) I get the following traceback:Note that the falsifying example at the bottom of the traceback refers to a variable
v2, which was never defined.I suspect that this has to do with the fact that
rule_1in the example returnsstateful.multiple.Extra Information
Python version:
3.7.3Hypothesis version:
4.36.2The text was updated successfully, but these errors were encountered: