mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-05-02 19:27:17 +00:00
34 lines
873 B
Python
34 lines
873 B
Python
import pytest
|
|
|
|
from ahriman.core.exceptions import InitializeError
|
|
from ahriman.models.repository_id import RepositoryId
|
|
|
|
|
|
def test_post_init() -> None:
|
|
"""
|
|
must raise InitializeError if name is empty
|
|
"""
|
|
RepositoryId("x86_64", "aur-clone")
|
|
|
|
with pytest.raises(InitializeError):
|
|
RepositoryId("x86_64", "")
|
|
|
|
|
|
def test_lt() -> None:
|
|
"""
|
|
must correctly compare instances
|
|
"""
|
|
assert RepositoryId("x86_64", "a") < RepositoryId("x86_64", "b")
|
|
assert RepositoryId("x86_64", "b") > RepositoryId("x86_64", "a")
|
|
|
|
assert RepositoryId("i686", "a") < RepositoryId("x86_64", "a")
|
|
assert RepositoryId("x86_64", "a") > RepositoryId("i686", "a")
|
|
|
|
|
|
def test_lt_invalid() -> None:
|
|
"""
|
|
must raise ValueError if other is not valid repository id
|
|
"""
|
|
with pytest.raises(ValueError):
|
|
RepositoryId("x86_64", "a") < 42
|