NpmVeresionRange is giving incorrect version range sequence for prerelease caret range
keshav-space opened this issue · 0 comments
keshav-space commented
NpmVeresionRange is giving incorrect version range sequence for prerelease caret range
>>> from univers.version_range import NpmVersionRange
>>> from univers.versions import SemverVersion
>>> range = NpmVersionRange.from_native("^1.2.3-beta.2")
>>> str(range)
'vers:npm/>=1.2.3-beta.2|>=1.2.3|<1.2.4|<2.0.0'
>>> SemverVersion("1.2.3-beta.3") in range
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "../univers/src/univers/version_range.py", line 224, in __contains__
return contains_version(version, self.constraints)
File "../univers/src/univers/version_constraint.py", line 542, in contains_version
raise Exception(f"Invalid constraints sequence: {constraints }")
Exception: Invalid constraints sequence: [VersionConstraint(comparator='>=', version=SemverVersion(string='1.2.3-beta.2')), VersionConstraint(comparator='>=', version=SemverVersion(string='1.2.3')), VersionConstraint(comparator='<', version=SemverVersion(string='1.2.4')), VersionConstraint(comparator='<', version=SemverVersion(string='2.0.0'))]
The correct sequence of constraints should be
'vers:npm/>=1.2.3-beta.2|<2.0.0'