Skip to content

Commit

Permalink
Add specifier tests
Browse files Browse the repository at this point in the history
  • Loading branch information
notatallshaw committed Aug 26, 2024
1 parent e84e341 commit 843c31c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def test_comparison_non_specifier(self):
("2.0.post1", ">=2"),
("2.0.post1.dev1", ">=2"),
("3", ">=2"),
("3.0.0a8", ">=3.0.0a7"),
# Test the less than equal operation
("2.0", "<=2"),
("2.0", "<=2.0"),
Expand All @@ -341,16 +342,19 @@ def test_comparison_non_specifier(self):
("2.0c1.post1.dev1", "<=2"),
("2.0rc1", "<=2"),
("1", "<=2"),
("3.0.0a7", "<=3.0.0a8"),
# Test the greater than operation
("3", ">2"),
("2.1", ">2.0"),
("2.0.1", ">2"),
("2.1.post1", ">2"),
("2.1+local.version", ">2"),
("3.0.0a8", ">3.0.0a7"),
# Test the less than operation
("1", "<2"),
("2.0", "<2.1"),
("2.0.dev0", "<2.1"),
("3.0.0a7", "<3.0.0a8"),
# Test the compatibility operation
("1", "~=1.0"),
("1.0.1", "~=1.0"),
Expand Down Expand Up @@ -560,6 +564,11 @@ def test_specifiers_prereleases(self, specifier, version, expected):
(">=1.0", None, ["2.0a1"], ["2.0a1"]),
(">=1.0.dev1", None, ["1.0", "2.0a1"], ["1.0", "2.0a1"]),
(">=1.0.dev1", False, ["1.0", "2.0a1"], ["1.0"]),
("!=2.0a1", None, ["1.0a2", "1.0", "2.0a1"], ["1.0"]),
("==2.0a1", None, ["2.0a1"], ["2.0a1"]),
(">2.0a1", None, ["2.0a1", "3.0a2", "3.0"], ["3.0a2", "3.0"]),
("<2.0a1", None, ["1.0a2", "1.0", "2.0a1"], ["1.0a2", "1.0"]),
("~=2.0a1", None, ["1.0", "2.0a1", "3.0a2", "3.0"], ["2.0a1"]),
],
)
def test_specifier_filter(self, specifier, prereleases, input, expected):
Expand Down

0 comments on commit 843c31c

Please sign in to comment.