I often generate lists of models using the lists_factory in hypothesis_sqlalchemy.tabular.records, but sometimes I have the issue that I need to apply a filter function to each generated model. For example, I have a model that has always one of three foreign keys set, so I want to filter out all examples where this is not the case. However, if I apply .filter to the entire list of generated models, hypothesis will take a very long time to figure out what is wrong and what to avoid, so I'd rather just filter out those specific examples that violate the constraint, while maintaining replayability.
Would it be possible to allow lists_factory to accept a function that is then applied to each individual values_tuples pair it generates?
I often generate lists of models using the
lists_factory
inhypothesis_sqlalchemy.tabular.records
, but sometimes I have the issue that I need to apply a filter function to each generated model. For example, I have a model that has always one of three foreign keys set, so I want to filter out all examples where this is not the case. However, if I apply.filter
to the entire list of generated models, hypothesis will take a very long time to figure out what is wrong and what to avoid, so I'd rather just filter out those specific examples that violate the constraint, while maintaining replayability.Would it be possible to allow
lists_factory
to accept a function that is then applied to each individualvalues_tuples
pair it generates?