-
Notifications
You must be signed in to change notification settings - Fork 14
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 function to invert constraints and ranges #91 #92
Conversation
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
@pombredanne I made inversion of each comparator here:
would like to get your opinion on this |
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.
Thanks... see some comments for your review
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
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.
Thanks!
see my review inline for your consideration.
IMHO the inversion should be first a method on a constraint and then second a range method that use the constraints method.
We would need a few unit tests rather than only data driven tests, and we could get fewer tests by removing duplicated tests.
Add unit tests for each kind Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
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.
Thanks. Here are a few extra nit pickings for your consideration.
tests/test_version_range.py
Outdated
@@ -393,3 +393,20 @@ def test_npm_advisory_version_range_parse(test_case): | |||
string=test_case["npm_native"], | |||
) | |||
assert str(result) == test_case["expected_vers"] | |||
|
|||
|
|||
def test_inverse(): |
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.
You need tests for the lower level constraint.invert e.g., for https://github.com/nexB/univers/pull/92/files#diff-c77d34029ce1991650937489359eef45029f37be4f1f27c21f56e50e64209d9aR138 too
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.
Done!
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
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.
LGTM!
👍
Signed-off-by: Tushar Goel tushar.goel.dav@gmail.com
We have invert of every operator:
But we don't have any inversion for star operator currently, what should we do for that ?