-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nonEmptyListOf.sample started to return None #708
Comments
I experience a similar behavior in generators that don't use |
Is there a reason you're using The canonical property test of your generator would be something like: property("nonEmptyListOf(chooseNum)") = {
Prop.forAll(Gen.nonEmptyListOf(Gen.chooseNum(0,100))) { l =>
l.length > 0
}
} The above works fine for me. |
Previously we used the standard buildableOf and just filtered out empty collections. However, given that the underlying methods support a size parameter it's just as easy to inline buildableOf's implementation and start the minimum size at 1, not 0. Fixes typelevel#708
I agree with @ashawley that it's better to avoid However, I've independently been trying to reduce how often this happens, and noticed that it was fairly easy to avoid needing |
Also, you need to use |
Dear fellow developers,
After migration from 1.14.3 to 1.15
Gen.nonEmptyListOf.sample
started to behave differentlly.This code works on version 1.14.3 but sometimes brakes on version 1.15.0 and 1.15.1:
The reason for failure always will be
None
after the methodsample
.The text was updated successfully, but these errors were encountered: