I'd like to get the minimum for a complicated class, for which I have already written a strategy.
Is it possible to ask hypothesis to simply give me the minimum example for a given strategy?
Context here is writing a strategy and a default minimum (for use in @hypothesis.example
) - surely the information for the latter is already contained in the former?
import dataclasses
import hypothesis
from hypothesis import strategies
@dataclasses.dataclass
class Foo:
bar: int
# Foo has many more attributes which are strategised over...
@classmethod
def strategy(cls):
return hypothesis.builds(cls, bar=strategies.integers())
@classmethod
def minimal(cls):
return hypothesis.minimal(cls.strategy())