3 ms·
I understand your pain in some sense, but on another I feel like people with a decent amount of hypothesis experience "know" how the generator works and would u
by rtpg 2y ago
I understand your pain in some sense, but on another I feel like people with a decent amount of hypothesis experience "know" how the generator works and would understand that you basically _never_ want to use `filter` if you can avoid it, instead relying on unfalsifiable generation.
Silly idea for your generator would to generate an array, and if it's zero... draw a random index and a random non-zero number and add it into the array. Leads to some weird non-convexity properties but is a workable hack.
In your own example you turned off the "data too slow" issue, probably because building up a dataframe (all to just do a column sum!) is actually kind of costly at large numbers! Your complaint is probably actually meant for the pandas extras (or pandas itself) rather than the concept of hypothesis.
- epgui 2y agoNo, I ran into the same issues with basic data structures. The dataframe wasn’t necessary, it just matched the expected input of some function I wanted to test.
- rtpg 2y agoI took your case, I got way better perf just generating a list of numbers and then reshaping it into a dataframe. But! Even though it doesn't even get that much slower at a certain number of rows it just starts hanging! Like at 49 rows everything is still fine and at 50 it no longer wants to work. It's very bizarre and I'll see if I can debug it. But I think your test case isn't indicative of some fundamental issue with Hypothesis rather than some sort of bug.
- tybug 2y agoThat kind of behavior can happen at the threshold of Hypothesis' internal limit on entropy - though if you're not hitting HealthCheck.data_too_large then this seems unlikely. Let me know if you have a reproducer, I'd be curious to take a look.
- deleted 2y ago[deleted]
- epgui 2y ago> Even though it doesn't even get that much slower at a certain number of rows it just starts hanging Yes, this brings back memories. I've definitely seen this kind of behaviour as well, in many different, not-particularly-exotic, situations. I am absolutely convinced the issue I raised on the github project was a bug or a defect, despite the maintainers not taking it seriously. I find QuickCheck and Clojure spec/test.check much more straightforward to use. I just never ran into this sort of thing with these other tools.