Skip to content

Commit

Permalink
Handle NoneType in VersionRange.from_string (#115)
Browse files Browse the repository at this point in the history
* Handle NoneType in VersionRange.from_string

Signed-off-by: Keshav Priyadarshi <git@keshav.space>

* Address review comments

Signed-off-by: Keshav Priyadarshi <git@keshav.space>

---------

Signed-off-by: Keshav Priyadarshi <git@keshav.space>
  • Loading branch information
keshav-space authored Aug 31, 2023
1 parent 9c783c7 commit 0113d67
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/univers/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def from_string(cls, vers, simplify=False, validate=False):
Return a VersionRange built from a ``vers`` version range spec string,
such as "vers:npm/1.2.3,>=2.0.0"
"""
if not vers or not isinstance(vers, str) or not vers.strip():
raise ValueError(
f"{vers!r} is not a valid argument, a valid ``vers`` string argument is required."
)

# Spaces are not significant and removed in a canonical form.
vers = remove_spaces(vers)

Expand Down

0 comments on commit 0113d67

Please sign in to comment.