From 4ff6f4841cc4b88ebd3d2e3e0cec6e86d591d80f Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Wed, 5 Nov 2025 16:06:44 +0100 Subject: [PATCH] :sparkles: Add testing with cool dataset --- .gitmodules | 3 + j.txt | 844 -------------------------------------------- tests/dataset | 1 + tests/esc_data.json | 118 ------- tests/test_esc.py | 128 ++++++- 5 files changed, 124 insertions(+), 970 deletions(-) create mode 100644 .gitmodules delete mode 100644 j.txt create mode 160000 tests/dataset delete mode 100644 tests/esc_data.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5e37df0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests/dataset"] + path = tests/dataset + url = https://github.com/EurovisionAPI/dataset.git diff --git a/j.txt b/j.txt deleted file mode 100644 index d2a960e..0000000 --- a/j.txt +++ /dev/null @@ -1,844 +0,0 @@ -Parsing jury file: /tmp/tmpuiemxcw7 - Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 0 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 0 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 0 │ -│ Poland │ 17 │ 0 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 0 │ -│ Spain │ 27 │ 0 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Iceland (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 0 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 0 │ -│ Poland │ 17 │ 0 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 0 │ -│ Spain │ 27 │ 0 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for San Marino (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 0 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 0 │ -│ Poland │ 17 │ 0 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 0 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Poland (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 0 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 0 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 0 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Norway (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 0 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 0 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Luxembourg (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 0 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Spain (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 0 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Lithuania (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 0 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Portugal (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 0 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Armenia (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 0 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Albania (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 0 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Denmark (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 0 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Ukraine (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 0 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Israel (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 0 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Germany (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 0 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Malta (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 0 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for United Kingdom (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Finland (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 0 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Estonia (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 0 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Greece (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 0 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Latvia (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 42 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 0 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Sweden (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 42 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 0 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 195 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Netherlands (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 0 │ -│ Latvia │ 116 │ 42 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 42 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 195 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Italy (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 0 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 97 │ -│ Latvia │ 116 │ 42 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 42 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 195 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for France (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 50 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 97 │ -│ Latvia │ 116 │ 42 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 42 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 195 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Enter televoting score for Switzerland (go back with b): (0): Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ -│ Albania │ 45 │ 2 │ -│ Armenia │ 42 │ 30 │ -│ Austria │ 258 │ 0 │ -│ Denmark │ 45 │ 173 │ -│ Estonia │ 98 │ 258 │ -│ Finland │ 88 │ 0 │ -│ France │ 180 │ 50 │ -│ Germany │ 77 │ 74 │ -│ Greece │ 105 │ 126 │ -│ Iceland │ 0 │ 33 │ -│ Israel │ 60 │ 158 │ -│ Italy │ 159 │ 97 │ -│ Latvia │ 116 │ 42 │ -│ Lithuania │ 34 │ 62 │ -│ Luxembourg │ 23 │ 24 │ -│ Malta │ 83 │ 8 │ -│ Netherlands │ 133 │ 42 │ -│ Norway │ 22 │ 67 │ -│ Poland │ 17 │ 139 │ -│ Portugal │ 37 │ 13 │ -│ San Marino │ 9 │ 18 │ -│ Spain │ 27 │ 10 │ -│ Sweden │ 126 │ 195 │ -│ Switzerland │ 214 │ 0 │ -│ Ukraine │ 60 │ 297 │ -│ United Kingdom │ 88 │ 108 │ -└────────────────┴────────────┴──────────────────┘ -Final score entered! Review and continue? [y/n] (y): Please enter Y or N -Final score entered! Review and continue? [y/n] (y): Televoting scores have been successfully entered! -█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ Calculating final scores... Final Scores -┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ -┃ Name ┃ Jury Score ┃ Televoting Score ┃ Final Score ┃ -┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ -│ Ukraine │ 60 │ 297 │ 357 │ -│ Estonia │ 98 │ 258 │ 356 │ -│ Sweden │ 126 │ 195 │ 321 │ -│ Italy │ 159 │ 97 │ 256 │ -│ Greece │ 105 │ 126 │ 231 │ -│ France │ 180 │ 50 │ 230 │ -│ Israel │ 60 │ 158 │ 218 │ -│ Denmark │ 45 │ 173 │ 218 │ -│ Switzerland │ 214 │ 0 │ 214 │ -│ United Kingdom │ 88 │ 108 │ 196 │ -│ Netherlands │ 133 │ 42 │ 175 │ -│ Latvia │ 116 │ 42 │ 158 │ -│ Poland │ 17 │ 139 │ 156 │ -│ Germany │ 77 │ 74 │ 151 │ -│ Lithuania │ 34 │ 62 │ 96 │ -│ Malta │ 83 │ 8 │ 91 │ -│ Norway │ 22 │ 67 │ 89 │ -│ Finland │ 88 │ 0 │ 88 │ -│ Armenia │ 42 │ 30 │ 72 │ -│ Portugal │ 37 │ 13 │ 50 │ -│ Albania │ 45 │ 2 │ 47 │ -│ Luxembourg │ 23 │ 24 │ 47 │ -│ Spain │ 27 │ 10 │ 37 │ -│ Iceland │ 0 │ 33 │ 33 │ -│ San Marino │ 9 │ 18 │ 27 │ -│ Austria │ 258 │ -460 │ -202 │ -└────────────────┴────────────┴──────────────────┴─────────────┘ -Final scores have been calculated! -╭──────────────────────────── Winner Announcement ─────────────────────────────╮ -│ This year's winner is: 🎉 Ukraine 🎉 │ -╰────────────────────────────── Congratulations! ──────────────────────────────╯ diff --git a/tests/dataset b/tests/dataset new file mode 160000 index 0000000..8f9d423 --- /dev/null +++ b/tests/dataset @@ -0,0 +1 @@ +Subproject commit 8f9d4239bac5da8e2f0c5e2e04b9a9031a235ec1 diff --git a/tests/esc_data.json b/tests/esc_data.json deleted file mode 100644 index 02ec9cf..0000000 --- a/tests/esc_data.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "2025": { - "jury": { - "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 - }, - "televote": { - "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 - }, - "winner": "Austria" - }, - "2024": { - "jury": { - "Switzerland": 365, - "France": 218, - "Croatia": 210, - "Italy": 164, - "Ukraine": 146, - "Ireland": 142, - "Portugal": 139, - "Sweden": 125, - "Armenia": 101, - "Germany": 99, - "Luxembourg": 83, - "Israel": 52, - "United Kingdom": 46, - "Greece": 41, - "Latvia": 36, - "Cyprus": 34, - "Lithuania": 32, - "Serbia": 22, - "Spain": 19, - "Austria": 19, - "Georgia": 15, - "Slovenia": 15, - "Norway": 12, - "Finland": 7, - "Estonia": 4 - }, - "televote": { - "Croatia": 337, - "Israel": 323, - "Ukraine": 307, - "France": 227, - "Switzerland": 226, - "Ireland": 136, - "Italy": 104, - "Greece": 85, - "Armenia": 82, - "Lithuania": 58, - "Sweden": 49, - "Cyprus": 44, - "Estonia": 33, - "Serbia": 32, - "Finland": 31, - "Latvia": 28, - "Luxembourg": 20, - "Georgia": 19, - "Germany": 18, - "Portugal": 13, - "Slovenia": 12, - "Spain": 11, - "Austria": 5, - "Norway": 4, - "United Kingdom": 0 - }, - "winner": "Switzerland" - } -} diff --git a/tests/test_esc.py b/tests/test_esc.py index c010d71..bdb8222 100644 --- a/tests/test_esc.py +++ b/tests/test_esc.py @@ -3,21 +3,24 @@ import os import sys +from pathlib import Path +from typing import TypedDict import orjson sys.path.append(os.path.join(os.path.dirname(__file__), "..")) # noqa: PTH120, PTH118 import tempfile -from pathlib import Path -from typing import TypedDict import pytest from typer.testing import CliRunner from src.__main__ import app -data_path = Path(__file__).parent / "esc_data.json" +DATASET_BASE = Path(__file__).parent / "dataset" / "data" +DATASET_PATH = DATASET_BASE / "senior" + +YEARS_TO_TEST = list(range(2016, 2026)) class ESCData(TypedDict): @@ -26,12 +29,116 @@ class ESCData(TypedDict): jury: dict[str, int] televote: dict[str, int] winner: str + participating_countries: int + +with open(DATASET_BASE / "countries.json", "rb") as f: + COUNTRY_NAMES: dict[str, str] = orjson.loads(f.read()) + +def get_country_name(country_code: str) -> str: + """Convert country code to full country name.""" + + return COUNTRY_NAMES.get(country_code.upper(), country_code) -with data_path.open("r", encoding="utf-8") as f: - data = orjson.loads(f.read()) +def get_country_mapping(year: int) -> dict[int, str]: + """ + Map contestant IDs to country codes by reading the contestants directory. + Returns a dict: {contestant_id: country_code} + """ + contestants_dir = DATASET_PATH / str(year) / "contestants" + country_mapping: dict[int, str] = {} -ESC_DATA: dict[int, "ESCData"] = {int(year): value for year, value in data.items()} + if not contestants_dir.exists(): + return country_mapping + + for item in contestants_dir.iterdir(): + if item.is_dir(): + # Directory name format: N_XX where N is contestant ID and XX is country code + dir_name = item.name + if "_" in dir_name: + contestant_id_str, country_code = dir_name.split("_", 1) + try: + contestant_id = int(contestant_id_str) + country_mapping[contestant_id] = country_code.upper() + except ValueError: + pass + + return country_mapping + + +def count_participating_countries(year: int) -> int: + """Count the number of directories in the contestants folder.""" + contestants_dir = DATASET_PATH / str(year) / "contestants" + if not contestants_dir.exists(): + return 0 + return sum(1 for item in contestants_dir.iterdir() if item.is_dir()) + + +def parse_year_data(year: int) -> ESCData: + """Parse the data for a single year from the dataset.""" + final_json_path = DATASET_PATH / str(year) / "rounds" / "final.json" + + if not final_json_path.exists(): + pytest.skip(f"Data not found for year {year}") + + # Load the final.json data + with final_json_path.open("rb") as f: + data = orjson.loads(f.read()) + + country_mapping = get_country_mapping(year) + + # Count participating countries + participating_countries = count_participating_countries(year) + + jury_scores = {} + televote_scores = {} + winner = None + + performances = data.get("performances", []) + + for performance in performances: + contestant_id = performance.get("contestantId") + place = performance.get("place") + + country_code = country_mapping.get(contestant_id) + if not country_code: + continue + + country_name = get_country_name(country_code) + + if place == 1: + winner = country_name + + # Extract scores + scores = performance.get("scores", []) + for score in scores: + score_name = score.get("name") + points = score.get("points", 0) + + if score_name == "jury": + jury_scores[country_name] = points + elif score_name == "public": + televote_scores[country_name] = points + + # Sort by points (descending) + jury_scores = dict(sorted(jury_scores.items(), key=lambda x: x[1], reverse=True)) + televote_scores = dict(sorted(televote_scores.items(), key=lambda x: x[1], reverse=True)) + + return { + "jury": jury_scores, + "televote": televote_scores, + "winner": winner if winner else "Unknown", + "participating_countries": participating_countries, + } + + +# Parse all years data +ESC_DATA: dict[int, ESCData] = {} +for year in YEARS_TO_TEST: + try: + ESC_DATA[year] = parse_year_data(year) + except Exception as e: + print(f"Warning: Could not parse data for year {year}: {e}") # noqa: T201 TADA = "🎉" @@ -43,6 +150,7 @@ def test_esc_grand_final(year: int, data: ESCData) -> None: jury_scores: dict[str, int] = data["jury"] televote_scores: dict[str, int] = data["televote"] expected_winner: str = data["winner"] + participating_countries: int = data["participating_countries"] with tempfile.NamedTemporaryFile("w", delete=False, encoding="utf-8") as f: for country, score in jury_scores.items(): @@ -54,11 +162,15 @@ def test_esc_grand_final(year: int, data: ESCData) -> None: inputs.append("y") # to confirm the winner runner = CliRunner() - result = runner.invoke(app, ["--jury-path", f.name], input="\n".join(inputs)) + result = runner.invoke( + app, + ["--jury-path", f.name, "--participating-countries", str(participating_countries)], + input="\n".join(inputs), + ) try: actual = result.output.split(TADA)[1].strip().split()[0] except Exception: pytest.fail(f"Could not parse winner from output:\n{result.output}", pytrace=False) - assert actual == expected_winner, f"For {year}, expected winner {expected_winner} but got {actual!r}" + assert actual == expected_winner, f"For {year}, expected winner {expected_winner} but got {actual!r}" \ No newline at end of file