Skip to content

Commit 0113d67

Browse files
authored
Handle NoneType in VersionRange.from_string (#115)
* 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>
1 parent 9c783c7 commit 0113d67

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/univers/version_range.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ def from_string(cls, vers, simplify=False, validate=False):
9898
Return a VersionRange built from a ``vers`` version range spec string,
9999
such as "vers:npm/1.2.3,>=2.0.0"
100100
"""
101+
if not vers or not isinstance(vers, str) or not vers.strip():
102+
raise ValueError(
103+
f"{vers!r} is not a valid argument, a valid ``vers`` string argument is required."
104+
)
105+
101106
# Spaces are not significant and removed in a canonical form.
102107
vers = remove_spaces(vers)
103108

0 commit comments

Comments
 (0)