Merge #149 Adding some tests

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-10-11 17:50:21 +00:00
commit 057dd98350

View file

@ -78,8 +78,11 @@ def test_parse_version(version, parsed_version):
(Version(1, 0, None, None, None), '1.0.0'),
(Version(2, 1, 0, None, None), '2.1.0'),
(Version(2, 1, 0, None, 'build1'), '2.1.0+build1'),
(Version(2, 1, 0, None, 'snapshot-preview-build1'), '2.1.0+snapshot_preview_build1'),
(Version(2, 1, 0, 'alpha1', None), '2.1.0-alpha1'),
(Version(2, 1, 0, 'snapshot-preview-alpha1', None), '2.1.0-snapshot_preview_alpha1'),
(Version(2, 1, 0, 'alpha1', 'build1'), '2.1.0-alpha1+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):
result = rust2rpm.metadata.CargoSemVer.unparse_version(parsed_version)
@ -89,8 +92,11 @@ def test_unparse_version(parsed_version, version):
@pytest.mark.parametrize('parsed_version, version', [
(Version(2, 1, 0, None, None), '2.1.0'),
(Version(2, 1, 0, None, 'build1'), '2.1.0+build1'),
(Version(2, 1, 0, None, 'snapshot-preview-build1'), '2.1.0+snapshot_preview_build1'),
(Version(2, 1, 0, 'alpha1', None), '2.1.0~alpha1'),
(Version(2, 1, 0, 'snapshot-preview-alpha1', None), '2.1.0~snapshot_preview_alpha1'),
(Version(2, 1, 0, 'alpha1', 'build1'), '2.1.0~alpha1+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):
result = rust2rpm.metadata.CargoSemVer.unparse_version(