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

constraints: fix allows, allows_any and allows_all for generic constraints and increase test coverage #732

Merged

Conversation

radoering
Copy link
Member

While reviewing #722, I noticed some bugs in the existing implementation of allows, allows_any and allows_all for generic constraints combined with a low test coverage.

Further, I had some difficulties to tell what's the expected behavior of allows compared to allows_any and allows_all. When looking into version constraints for comparison, we can see that allows expects a version as argument while allows_any and allows_all expect arbitrary version constraints. The equivalent of a version is a generic constraint with an == operator (there is no explicit class as for version constraints). Therefore, I changed allows to raise an error when passing another argument than a constraint with an == operator to make the interface more clear.

  • Added tests for changed code.
  • Updated documentation for changed code.

@radoering radoering mentioned this pull request May 18, 2024
2 tasks
@radoering radoering requested a review from a team May 18, 2024 13:14
@radoering radoering force-pushed the fix-generic-constraint-allows branch from ffc93fb to e2f14b7 Compare May 31, 2024 13:52
@radoering radoering merged commit a243167 into python-poetry:main May 31, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants