Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
Signed-off-by: Kunz, Immanuel <immanuel.kunz@aisec.fraunhofer.de>
  • Loading branch information
immqu committed Nov 15, 2024
1 parent df2d2f6 commit 1e9d253
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/univers/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ def __contains__(self, version):

if self.version_class is AllVersion:
return True

if self.version_class is NoneVersion:
return False

if not isinstance(version, self.version_class):
raise TypeError(
f"{version!r} is not of expected type: {self.version_class!r}",
Expand Down
2 changes: 1 addition & 1 deletion src/univers/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class AllVersion(Version):
@classmethod
def is_valid(cls, string):
return string == "vers:all/*"


class NoneVersion(Version):
@classmethod
Expand Down
4 changes: 3 additions & 1 deletion tests/test_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def test_version_range_normalize_case3():

assert str(nvr) == "vers:pypi/>=1.0.0|<=1.3.0|3.0.0"


def test_version_range_all():
all_vers = VersionRange.from_string("vers:all/*")
assert all_vers.contains(Version("1.2.3"))
Expand All @@ -558,8 +559,9 @@ def test_version_range_all():
with pytest.raises(Exception):
VersionRange.from_string("vers:all/*|>1.2.3")


def test_version_range_none():
none_vers = VersionRange.from_string("vers:none/*")
none_vers = VersionRange.from_string("vers:none/*")
assert not none_vers.contains(Version("1.2.3"))
assert PypiVersion("2.0.3") not in none_vers
# test for invalid all range specification
Expand Down

0 comments on commit 1e9d253

Please sign in to comment.