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
As of #2030 we have a special case for lists(sampled_from(...), unique=True) that uses a custom strategy. Unfortunately this special casing is trivial to defeat. e.g. lists(sampled_from(...).map(lambda x: x), unique=True) should behave the same way but doesn't. It would be good to extend this support to include arbitrary chains of maps and filters over sampled_from.
There are a couple of possible ways to do this, but I think the easiest would be to extend the base SampledFrom strategy to have a transform function which takes an element of the sample and either transforms it or raises an UnsatisfiedAssumption (or returns a special value). The special case unique list strategy could then call this transformed function directly.
The text was updated successfully, but these errors were encountered:
We probably also want to add a special case for the st.dictionaries() strategy, which currently doesn't get any advantages at all if keys=st.sampled_from(...). That's now #2687.
As of #2030 we have a special case for
lists(sampled_from(...), unique=True)
that uses a custom strategy. Unfortunately this special casing is trivial to defeat. e.g.lists(sampled_from(...).map(lambda x: x), unique=True)
should behave the same way but doesn't. It would be good to extend this support to include arbitrary chains of maps and filters oversampled_from
.There are a couple of possible ways to do this, but I think the easiest would be to extend the base
SampledFrom
strategy to have atransform
function which takes an element of the sample and either transforms it or raises anUnsatisfiedAssumption
(or returns a special value). The special case unique list strategy could then call this transformed function directly.The text was updated successfully, but these errors were encountered: