pschanely / hypothesis-crosshair

Level-up your Hypothesis tests with CrossHair
MIT License
8 stars 0 forks source link

Invalid combination of arguments to `draw_boolean(...)` #18

Closed Zac-HD closed 4 months ago

Zac-HD commented 4 months ago

These assertions in Hypothesis check that if forced is True, then p > 0, and vice-versa at the other end - because it would be invalid to generate the forced value otherwise. However, the following example fails with Crosshair:

from hypothesis import settings
from hypothesis.stateful import RuleBasedStateMachine, rule, run_state_machine_as_test

@run_state_machine_as_test
@settings(backend="crosshair", deadline=None)
class IntListRules(RuleBasedStateMachine):

    @rule()
    def a(self): pass

    @rule()
    def b(self): pass

I'm reporting it here because of the draw_boolean() symptom, but I actually find it pretty plausible that it's an issue in Crosshair's reasoning about the internal FeatureStrategy (see here). As usual, found in https://github.com/HypothesisWorks/hypothesis/pull/4034 🙂

pschanely commented 4 months ago

Hmm. Well, I'm not sure exactly HOW it fixes it, but if I make my provider respect the p=1 and p=0 cases, it seems to fix your example, so Ima roll with that. Fixed in 0.0.8!