parent
093eef77a7
commit
5630d7df1e
1 changed files with 11 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import rust2rpm
|
import rust2rpm
|
||||||
from rust2rpm.metadata import Version
|
from rust2rpm.core.metadata import Version, CargoSemVer, Dependency
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("req, rpmdep", [
|
@pytest.mark.parametrize("req, rpmdep", [
|
||||||
|
@ -63,7 +63,7 @@ from rust2rpm.metadata import Version
|
||||||
"(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1~)"),
|
"(crate(test) >= 0.0.0~alpha.6 with crate(test) < 0.0.1~)"),
|
||||||
])
|
])
|
||||||
def test_dependency(req, rpmdep):
|
def test_dependency(req, rpmdep):
|
||||||
dep = rust2rpm.Dependency("test", req)
|
dep = Dependency("test", req)
|
||||||
assert str(dep) == rpmdep
|
assert str(dep) == rpmdep
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ def test_dependency(req, rpmdep):
|
||||||
('2.1.0-alpha1+build1', (2, 1, 0, 'alpha1', 'build1')),
|
('2.1.0-alpha1+build1', (2, 1, 0, 'alpha1', 'build1')),
|
||||||
])
|
])
|
||||||
def test_parse_version(version, parsed_version):
|
def test_parse_version(version, parsed_version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.parse_version(version)
|
result = CargoSemVer.parse_version(version)
|
||||||
assert result == parsed_version
|
assert result == parsed_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ def test_parse_version(version, parsed_version):
|
||||||
(Version(2, 1, 0, 'snapshot-preview-alpha1', 'snapshot-preview-build1'), '2.1.0-snapshot_preview_alpha1+snapshot_preview_build1'),
|
(Version(2, 1, 0, 'snapshot-preview-alpha1', 'snapshot-preview-build1'), '2.1.0-snapshot_preview_alpha1+snapshot_preview_build1'),
|
||||||
])
|
])
|
||||||
def test_unparse_version(parsed_version, version):
|
def test_unparse_version(parsed_version, version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.unparse_version(parsed_version)
|
result = CargoSemVer.unparse_version(parsed_version)
|
||||||
assert result == version
|
assert result == version
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ def test_unparse_version(parsed_version, version):
|
||||||
(Version(2, 1, 0, 'snapshot-preview-alpha1', 'snapshot-preview-build1'), '2.1.0~snapshot_preview_alpha1+snapshot_preview_build1'),
|
(Version(2, 1, 0, 'snapshot-preview-alpha1', 'snapshot-preview-build1'), '2.1.0~snapshot_preview_alpha1+snapshot_preview_build1'),
|
||||||
])
|
])
|
||||||
def test_unparse_version_sep(parsed_version, version):
|
def test_unparse_version_sep(parsed_version, version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.unparse_version(
|
result = CargoSemVer.unparse_version(
|
||||||
parsed_version, sep='~')
|
parsed_version, sep='~')
|
||||||
assert result == version
|
assert result == version
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ def test_unparse_version_sep(parsed_version, version):
|
||||||
('~=0.1.2', ('~=', (0, 1, 2, None, None))),
|
('~=0.1.2', ('~=', (0, 1, 2, None, None))),
|
||||||
])
|
])
|
||||||
def test_parse(requirement, parsed_requirement):
|
def test_parse(requirement, parsed_requirement):
|
||||||
result = rust2rpm.metadata.CargoSemVer.parse(requirement)
|
result = CargoSemVer.parse(requirement)
|
||||||
assert result == parsed_requirement
|
assert result == parsed_requirement
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ def test_parse(requirement, parsed_requirement):
|
||||||
(2, 1, 0, 'alpha1', 'build1')),
|
(2, 1, 0, 'alpha1', 'build1')),
|
||||||
])
|
])
|
||||||
def test_coerce(version, coerced_version):
|
def test_coerce(version, coerced_version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.coerce(version)
|
result = CargoSemVer.coerce(version)
|
||||||
assert result == coerced_version
|
assert result == coerced_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ def test_coerce(version, coerced_version):
|
||||||
((2, 0, 1, 'alpha1', 'build1'), (3, 0, 0, None, None)),
|
((2, 0, 1, 'alpha1', 'build1'), (3, 0, 0, None, None)),
|
||||||
])
|
])
|
||||||
def test_next_major(version, next_version):
|
def test_next_major(version, next_version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.next_major(version)
|
result = CargoSemVer.next_major(version)
|
||||||
assert result == next_version
|
assert result == next_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ def test_next_major(version, next_version):
|
||||||
((2, 1, 0, 'alpha1', 'build1'), (2, 1, 0, None, None)),
|
((2, 1, 0, 'alpha1', 'build1'), (2, 1, 0, None, None)),
|
||||||
])
|
])
|
||||||
def test_next_minor(version, next_version):
|
def test_next_minor(version, next_version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.next_minor(version)
|
result = CargoSemVer.next_minor(version)
|
||||||
assert result == next_version
|
assert result == next_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ def test_next_minor(version, next_version):
|
||||||
((2, 1, 0, 'alpha1', 'build1'), (2, 1, 0, None, None)),
|
((2, 1, 0, 'alpha1', 'build1'), (2, 1, 0, None, None)),
|
||||||
])
|
])
|
||||||
def test_next_patch(version, next_version):
|
def test_next_patch(version, next_version):
|
||||||
result = rust2rpm.metadata.CargoSemVer.next_patch(version)
|
result = CargoSemVer.next_patch(version)
|
||||||
assert result == next_version
|
assert result == next_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,5 +257,5 @@ def test_next_patch(version, next_version):
|
||||||
[('>=', (0, 0, 0, 'alpha.6', None)), ('<', (0, 0, 1, None, None))]),
|
[('>=', (0, 0, 0, 'alpha.6', None)), ('<', (0, 0, 1, None, None))]),
|
||||||
])
|
])
|
||||||
def test_normalize(requirement, normalized_requirement):
|
def test_normalize(requirement, normalized_requirement):
|
||||||
result = rust2rpm.metadata.CargoSemVer.normalize(requirement)
|
result = CargoSemVer.normalize(requirement)
|
||||||
assert result == normalized_requirement
|
assert result == normalized_requirement
|
||||||
|
|
Loading…
Reference in a new issue