Skip to content

Commit

Permalink
Fix allows_any() with local versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed May 5, 2023
1 parent f314393 commit f344461
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/poetry/core/constraints/version/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ def allows_all(self, other: VersionConstraint) -> bool:
)

def allows_any(self, other: VersionConstraint) -> bool:
if other.allows(self):
return True

if isinstance(other, Version):
return self.allows(other)

return other.allows(self)
return False

def intersect(self, other: VersionConstraint) -> Version | EmptyConstraint:
if other.allows(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/constraints/version/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def test_allows_all() -> None:
(
Version.parse("1.2.3+cpu"),
Version.parse("1.2.3"),
False,
True,
),
(
Version.parse("1.2.3"),
Expand Down

0 comments on commit f344461

Please sign in to comment.