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
4 changes: 3 additions & 1 deletion src/univers/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ def from_native(cls, string):
if ";" in string:
raise InvalidVersionRange(f"Unsupported PyPI environment marker: {string!r}")

unsupported_chars = ";<>!=\\/|{}()`?'\"\t\n "
unsupported_chars = ";\\/|{}()`?'\"\t\n "
string = string.replace(" ", "")

if any(c in string for c in unsupported_chars):
raise InvalidVersionRange(
f"Unsupported character: {unsupported_chars!r} " f"in PyPI version: {string!r}"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def test_VersionRange_contains_works_for_star_range(self):
def test_PypiVersionRange_raises_ivr_for_unsupported_ranges(self):
try:
PypiVersionRange.from_native(
"~= 0.9, >= 1.0, != 1.3.4.*, < 2.0, ~= 1.3.4.*, ===1.0, ==1.*"
"~= 0.9, >= 1.0, != 1.3.4.*, < 2.0, ~= 1.3.4.*, ===1.0, ==1.* )"
)
raise Exception("Exception not raised")
except InvalidVersionRange as ivre:
Expand All @@ -211,7 +211,7 @@ def test_PypiVersionRange_raises_ivr_for_invalid_ranges(self):
PypiVersionRange.from_native("~= 1.3, ===1.0, ==1.*")
raise Exception("Exception not raised")
except InvalidVersionRange as ivre:
assert str(ivre).startswith("Unsupported character")
assert "Unsupported PyPI version constraint operator" in str(ivre)

def test_NpmVersionRange_from_native_with_compatible_with_version_operator(self):
npm_range = "^1.2.9"
Expand Down