Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/univers/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,15 @@ def __str__(self):


class AllVersion(Version):
pass
@classmethod
def is_valid(cls, string):
return string == "vers:all/*"


class NoneVersion(Version):
pass
@classmethod
def is_valid(cls, string):
return string == "vers:none/*"


class GenericVersion(Version):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ def test_version_range_all():
all_vers = VersionRange.from_string("vers:all/*")
assert all_vers.contains(Version("1.2.3"))
assert PypiVersion("2.0.3") in all_vers
# test for invalid all range specification
with pytest.raises(Exception):
VersionRange.from_string("vers:all/>1.2.3")
with pytest.raises(Exception):
VersionRange.from_string("vers:all/*|>1.2.3")
Comment thread
immqu marked this conversation as resolved.

def test_version_range_none():
none_vers = VersionRange.from_string("vers:none/*")
Expand Down