You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a REPL set up for continuously testing the program I'm working on using some hypothesis tests. The inputs are fairly large dataclasses that are unfortunately self-referential.
This works well in general, but when I attempt to tap result generation via a callable in TESTCASE_CALLBACKS, things slow down or crash due to blowing the stack. I have my own pretty-printers that I'd like to call from the repl experience, so I don't have any use for the jsonable or pprinted inputs. I checked over the code to see if I could find a flag to override the behavior (or return my own value for either) but I couldn't find any reasonable solution.
Would you be willing to consider making that behavior optionable via a flag or bump the to_json check earlier in the to_jsonable resolution chain?
I'd be happy to patch it to save you the time if a solution jumps out at you as a good one.
I'd prefer not to add another config option, but would be happy to shift the .to_json() check to before the attrs/dataclasses/pydantic block in to_jsonable(). PR welcome for that!
Thanks for Hypothesis, it's awesome!
I have a REPL set up for continuously testing the program I'm working on using some hypothesis tests. The inputs are fairly large dataclasses that are unfortunately self-referential.
This works well in general, but when I attempt to tap result generation via a callable in TESTCASE_CALLBACKS, things slow down or crash due to blowing the stack. I have my own pretty-printers that I'd like to call from the repl experience, so I don't have any use for the jsonable or pprinted inputs. I checked over the code to see if I could find a flag to override the behavior (or return my own value for either) but I couldn't find any reasonable solution.
Would you be willing to consider making that behavior optionable via a flag or bump the
to_json
check earlier in theto_jsonable
resolution chain?I'd be happy to patch it to save you the time if a solution jumps out at you as a good one.
Thanks!
Josh
to_jsonable
only attempts user-configurable to_json if all else fails
impossible to prevent jsonification when TESTCASE_CALLBACKS are present
The text was updated successfully, but these errors were encountered: