Run library, checks and downloads in background threads with parallel fetching
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""Tests for version comparison logic."""
|
||||
|
||||
from src.version_compare import CompareResult, compare_versions, normalize_version
|
||||
|
||||
|
||||
class TestNormalizeVersion:
|
||||
def test_strips_gog_suffix(self) -> None:
|
||||
assert normalize_version("2.2 (gog-3)") == "2.2"
|
||||
|
||||
def test_strips_galaxy_suffix(self) -> None:
|
||||
assert normalize_version("1.0 (Galaxy)") == "1.0"
|
||||
|
||||
def test_plain_unchanged(self) -> None:
|
||||
assert normalize_version("1.63") == "1.63"
|
||||
|
||||
|
||||
class TestCompareVersions:
|
||||
def test_equal_exact(self) -> None:
|
||||
assert compare_versions("1.63", "1.63") == CompareResult.EQUAL
|
||||
|
||||
def test_equal_after_normalize(self) -> None:
|
||||
assert compare_versions("2.2", "2.2 (gog-3)") == CompareResult.EQUAL
|
||||
|
||||
def test_older(self) -> None:
|
||||
assert compare_versions("1.52", "1.63") == CompareResult.OLDER
|
||||
|
||||
def test_newer(self) -> None:
|
||||
assert compare_versions("2.0", "1.9") == CompareResult.NEWER
|
||||
|
||||
def test_different_part_counts_padded(self) -> None:
|
||||
assert compare_versions("1.0", "1.0.1") == CompareResult.OLDER
|
||||
assert compare_versions("1.0.0", "1.0") == CompareResult.EQUAL
|
||||
|
||||
def test_empty_is_ambiguous(self) -> None:
|
||||
assert compare_versions("", "1.0") == CompareResult.AMBIGUOUS
|
||||
assert compare_versions("1.0", "") == CompareResult.AMBIGUOUS
|
||||
|
||||
def test_non_numeric_is_ambiguous(self) -> None:
|
||||
assert compare_versions("alpha", "beta") == CompareResult.AMBIGUOUS
|
||||
|
||||
def test_numeric_vs_nonnumeric_is_ambiguous(self) -> None:
|
||||
# "2.2(gog-3)" normalizes to "2.2" (numeric), "2.3a" is not numeric
|
||||
assert compare_versions("2.2 (gog-3)", "2.3a") == CompareResult.AMBIGUOUS
|
||||
Reference in New Issue
Block a user