Support consumes(some_bundle).filter(...)
for stateful tests
#3944
Labels
enhancement
it's not broken, but we want it to be better
Inspired by pydata/xarray#8658 (comment): you can't currently filter a
consumes(bundle)
strategy, which would be useful:consumes(bundle).filter(fn)
basically works, but the retries inFilteredStrategy.do_draw()
mean that you're likely to consume more elements from the bundle than intended. That's semantically OK - maybe we just chose never to refer to them again later - but can be a performance hit if acceptable elements are rare, and you're already missing the filtering-sampled_from fast path.consumes(bundle.filter(fn))
is disallowed by the types involved, but not for any especially principled reason.So... let's just fix that! A
BundleReferenceStrategy
is practically aSampledFromStrategy
already, so I propose that we makeBundle
a subclass ofSampledFromStrategy
. That would give us automatic support for both cases above, as well as all the nice logic for efficient handling of filter (and map) transforms, unique collections, and so on.(we might as well inline
BundleReferenceStrategy
intoBundle
while we're at it; there's no real reason to have it separate)The text was updated successfully, but these errors were encountered: