29 lines
949 B
Python
29 lines
949 B
Python
import pytest
|
|
from redmine_reporter.utils import hours_to_human, get_month_name_from_range, get_version
|
|
|
|
|
|
def test_hours_to_human():
|
|
assert hours_to_human(0) == "0ч"
|
|
assert hours_to_human(1.0) == "1ч"
|
|
assert hours_to_human(2.5) == "2ч 30м"
|
|
assert hours_to_human(0.75) == "45м"
|
|
assert hours_to_human(3.1666) == "3ч 10м" # ≈ 3ч 10м
|
|
|
|
|
|
def test_get_month_name_from_range():
|
|
assert get_month_name_from_range("2026-01-01", "2026-01-31") == "Январь"
|
|
assert get_month_name_from_range("2025-12-01", "2026-02-15") == "Февраль" # берётся to_date
|
|
assert get_month_name_from_range("invalid", "also_invalid") == "Январь" # fallback
|
|
|
|
|
|
def test_get_version():
|
|
class MockIssue:
|
|
pass
|
|
|
|
issue_with = MockIssue()
|
|
issue_with.fixed_version = "v2.5.0"
|
|
assert get_version(issue_with) == "v2.5.0"
|
|
|
|
issue_without = MockIssue()
|
|
assert get_version(issue_without) == "<N/A>"
|