Files
esc-dramatic-unpause/tests/test_esc_2025.py

86 lines
2.3 KiB
Python
Raw Normal View History

2025-06-10 21:45:48 +02:00
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import tempfile
from typer.testing import CliRunner
from src.__main__ import app
# 2025 Eurovision Grand Final jury scores
JURY_SCORES = {
"Austria": 258,
"Switzerland": 214,
"France": 180,
"Italy": 159,
"Netherlands": 133,
"Sweden": 126,
"Latvia": 116,
"Greece": 105,
"Estonia": 98,
"United Kingdom": 88,
"Finland": 88,
"Malta": 83,
"Germany": 77,
"Ukraine": 60,
"Israel": 60,
"Albania": 45,
"Denmark": 45,
"Armenia": 42,
"Portugal": 37,
"Lithuania": 34,
"Spain": 27,
"Luxembourg": 23,
"Norway": 22,
"Poland": 17,
"San Marino": 9,
"Iceland": 0,
}
# 2025 Eurovision Grand Final televoting scores
TELEVOTE_SCORES = {
"Israel": 297,
"Estonia": 258,
"Sweden": 195,
"Austria": 178,
"Albania": 173,
"Ukraine": 158,
"Poland": 139,
"Greece": 126,
"Finland": 108,
"Italy": 97,
"Germany": 74,
"Norway": 67,
"Lithuania": 62,
"France": 50,
"Latvia": 42,
"Netherlands": 42,
"Iceland": 33,
"Armenia": 30,
"Luxembourg": 24,
"San Marino": 18,
"Portugal": 13,
"Spain": 10,
"Malta": 8,
"Denmark": 2,
"United Kingdom": 0,
"Switzerland": 0,
}
RETURN = """
Winner Announcement
This year's winner is: 🎉 Austria 🎉 │
Congratulations!
"""
def test_esc_2025():
with tempfile.NamedTemporaryFile(delete=False, mode='w', encoding='utf-8') as jury_file:
jury_file.write("\n".join(f"{country} {score}" for country, score in JURY_SCORES.items()))
runner = CliRunner()
i: str = ""
for country in reversed(list(JURY_SCORES.keys())):
i += f"{TELEVOTE_SCORES[country]}\n"
i += "y\n"
result = runner.invoke(app, ["--jury-path", jury_file.name], input=i)
assert result.stdout.strip().endswith(RETURN), f"Expected output to end with {RETURN.strip()}, got {result.output.strip()}"