-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement high-level manipulation of version and release
Signed-off-by: Nikola Forró <nforro@redhat.com>
- Loading branch information
Showing
3 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
|
||
import pytest | ||
|
||
from specfile.specfile import Specfile | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"raw_release, release, dist", | ||
[ | ||
("1%{?dist}", "1", "%{?dist}"), | ||
("0.1%{prerelease}%{dist}", "0.1%{prerelease}", "%{dist}"), | ||
("28%dist", "28", "%dist"), | ||
("%{release_string}", "%{release_string}", ""), | ||
], | ||
) | ||
def test_split_raw_release(raw_release, release, dist): | ||
assert Specfile._split_raw_release(raw_release) == (release, dist) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"raw_release, release, result", | ||
[ | ||
("1%{?dist}", "28", "28%{?dist}"), | ||
("0.1%{prerelease}%{dist}", "1", "1%{dist}"), | ||
("28%dist", "0.1", "0.1%dist"), | ||
("%{release_string}", "1", "1"), | ||
], | ||
) | ||
def test_get_updated_release(raw_release, release, result): | ||
assert Specfile._get_updated_release(raw_release, release) == result |