Coverage for rust2rpm/tests/test_utils.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-27 15:21 +0100

1import pytest 

2 

3from rust2rpm.utils import package_name_suffixed, package_name_compat 

4 

5 

6@pytest.mark.parametrize( 

7 "crate,suffix,expected", 

8 [ 

9 ("syn", "0.4", "rust-syn0.4"), 

10 ("syn", "1", "rust-syn1"), 

11 ("socket2", "0.3", "rust-socket2_0.3"), 

12 ("version-compare", "0.0.11", "rust-version-compare0.0.11"), 

13 ], 

14 ids=repr, 

15) 

16def test_package_name_suffixed(crate: str, suffix: str, expected: str): 

17 assert package_name_suffixed(crate, suffix) == expected 

18 

19 

20@pytest.mark.parametrize( 

21 "crate,version,expected", 

22 [ 

23 ("syn", "0.4.0", "rust-syn0.4"), 

24 ("syn", "1.0.109", "rust-syn1"), 

25 ("socket2", "0.3.4", "rust-socket2_0.3"), 

26 ("version-compare", "0.0.11", "rust-version-compare0.0.11"), 

27 ], 

28 ids=repr, 

29) 

30def test_package_name_compat(crate: str, version: str, expected: str): 

31 assert package_name_compat(crate, version) == expected