poetry-core icon indicating copy to clipboard operation
poetry-core copied to clipboard

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

Open radoering opened this issue 1 year ago • 0 comments

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.

  • [x] Added tests for changed code.
  • [ ] Updated documentation for changed code.

radoering avatar May 18 '24 12:05 radoering