-
Notifications
You must be signed in to change notification settings - Fork 27
Add Not to allow predicate negation #45
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
Add Not to allow predicate negation #45
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #45 +/- ##
==========================================
+ Coverage 94.25% 94.50% +0.24%
==========================================
Files 2 2
Lines 174 200 +26
Branches 27 29 +2
==========================================
+ Hits 164 189 +25
- Misses 8 9 +1
Partials 2 2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Zac-HD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable; it won't actually help Hypothesis but nor will it hurt and it's simple to explain and implement.
- Consider defining
Predicate.__invert__so we can write~Predicate[fn]as sugar forPredicate[Not[fn]]? - I'd favor runtime checks (
if __debug__:) that (a) whateverNot[...]wraps is a callable and not an instance ofBaseMetadata, and (b) that whatever non-PredicateBaseMetadataclasses wrap is not aNot. Seems kinda silly, but it's the kind of thing that can avoid a surprising amount of pain later. Perf impact seems small, but maybe we really care about it anyway 🤔
Do you mean that we check to prohibit |
|
Either of those seem fine, but I'd ban eg |
Won't this already be rejected by type checkers? |
|
Yeah, seems fine to rely on static type checking if we expect users to have that. |
|
I think that’s a fair bet and I’d rather rely on that than adding more runtime type checking here. |
No description provided.