Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/univers/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def from_versions(cls, sequence):
version_obj = cls.version_class(version)
constraint = VersionConstraint(comparator="=", version=version_obj)
constraints.append(constraint)
return cls(constraints=constraints)
return cls(constraints=constraints) if constraints else None

def is_star(self):
return len(self.constraints) == 1 and self.constraints[0].is_star()
Expand Down
7 changes: 7 additions & 0 deletions tests/test_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ def test_AlpineLinuxVersionRange_from_versions():
assert version_range == expected


def test_VersionRange_from_versions_with_empty_constraints():
sequence = []
expected = None
version_range = AlpineLinuxVersionRange.from_versions(sequence)
assert version_range == expected


def test_apk_in_RANGE_CLASS_BY_SCHEMES():
assert RANGE_CLASS_BY_SCHEMES["apk"] is AlpineLinuxVersionRange

Expand Down