-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
constraints: make EmptyConstraint hashable and tidy up a bit
- Loading branch information
1 parent
45dcad4
commit 3905d3e
Showing
8 changed files
with
56 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from poetry.core.constraints.version import EmptyConstraint | ||
from poetry.core.constraints.version import Version | ||
from poetry.core.constraints.version import VersionRange | ||
from poetry.core.constraints.version import VersionUnion | ||
|
||
|
||
if TYPE_CHECKING: | ||
from poetry.core.constraints.version import VersionConstraint | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"constraint", | ||
[ | ||
EmptyConstraint(), | ||
Version.parse("1"), | ||
VersionRange(Version.parse("1"), Version.parse("2")), | ||
VersionUnion( | ||
VersionRange(Version.parse("1"), Version.parse("2")), | ||
VersionRange(Version.parse("3"), Version.parse("4")), | ||
), | ||
], | ||
) | ||
def test_constraints_are_hashable(constraint: VersionConstraint) -> None: | ||
# We're just testing that constraints are hashable, there's nothing much to say | ||
# about the result. | ||
hash(constraint) |