Repository navigation
Fix invert() for ranges made only of != constraints - #215
Open
akashrajeev wants to merge 1 commit into
Open
akashrajeev wants to merge 1 commit into
akashrajeev wants to merge 1 commit into
Conversation
A range built only of != constraints, which is what invert() returns for an enumerated range like vers:pypi/1.0.0|2.0.0, matched no version at all, so a version outside the original range was in neither the range nor its complement. Such a range now contains every version except the excluded ones. Fixes aboutcode-org#214 Signed-off-by: AKASH RAJEEV K V <akashrajeev.313@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spotted #214 and reproduced it on latest main. For something like vers:pypi/1.0.0|2.0.0, invert() hands back the != form of the range, but that result matched nothing at all, so a version outside the original range ended up in neither the range nor its complement.
This makes an all-!= range contain every version except the excluded ones. Mixed =/!= ranges behave exactly as before. Added tests for the reported case, double inversion, and a mixed range.
Fixes #214