diff --git a/src/univers/version_constraint.py b/src/univers/version_constraint.py index 2b782037..2613a487 100644 --- a/src/univers/version_constraint.py +++ b/src/univers/version_constraint.py @@ -225,7 +225,7 @@ def split(string): # "<<2.3" and ">>2.3" in VERS constraints which are explicitly not supported in VERS. elif version and version[0] in "<>!=*": raise ValueError(f"Unknown comparator in constraint: {constraint_string!r}") - + return comparator, version # default to equality diff --git a/src/univers/version_range.py b/src/univers/version_range.py index e25a355c..c50bc87c 100644 --- a/src/univers/version_range.py +++ b/src/univers/version_range.py @@ -1016,7 +1016,7 @@ class EbuildVersionRange(VersionRange): class AlpineLinuxVersionRange(VersionRange): - scheme = "alpine" + scheme = "apk" version_class = versions.AlpineLinuxVersion diff --git a/tests/test_version_constraint.py b/tests/test_version_constraint.py index 34c1450e..9997b7c7 100644 --- a/tests/test_version_constraint.py +++ b/tests/test_version_constraint.py @@ -88,10 +88,11 @@ def test_invert_opertaion(original, inverted): else: assert constraint.invert() is None + @pytest.mark.parametrize("spec", ["<<2.3", ">>2.3"]) def test_invalid_vers_comparator_prefixes(spec): with pytest.raises(ValueError, match="Unknown comparator"): VersionConstraint.from_string( string=spec, version_class=versions.SemverVersion, - ) \ No newline at end of file + ) diff --git a/tests/test_version_range.py b/tests/test_version_range.py index fc84188c..b2cb3c4a 100644 --- a/tests/test_version_range.py +++ b/tests/test_version_range.py @@ -220,6 +220,13 @@ def test_AlpineLinuxVersionRange_from_versions(): assert version_range == expected +def test_AlpineLinuxVersionRange_has_apk_scheme(): + sequence = ["3.18.0", "2.14.9-r1", "3.0.0"] + expected = "vers:apk/2.14.9-r1|3.0.0|3.18.0" + version_range = AlpineLinuxVersionRange.from_versions(sequence).to_string() + assert version_range == expected + + def test_VersionRange_from_versions_with_empty_constraints(): sequence = [] expected = None