Skip to content
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

hypothesis types strategies should accept constraints #1

Open
averagehat opened this issue Mar 14, 2016 · 1 comment
Open

hypothesis types strategies should accept constraints #1

averagehat opened this issue Mar 14, 2016 · 1 comment

Comments

@averagehat
Copy link
Owner

e.g.

type_to_strat(SettingsObj, { 'x' : {'min_size' : 3 } })
@averagehat
Copy link
Owner Author

Alternative: use .filter and the name of the type. The filter gets applied after the construction of that type. i.e.

type_to_strat(GianRobot, { Point3D : lambda p: p.x >= 0 and p.y >= 0 and p.z >= 0 } )

results in

Point3D(x,y,z).filter(lambda p: . . . . 

This would be trivial if we could define some public constructor for Point3D which returned Either or Option, but I don't believe it's possible to make the type of __new__ for class T something other than T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant