diff --git a/src/solo_turnier/html_parser.py b/src/solo_turnier/html_parser.py
index 11df844..efd8698 100644
--- a/src/solo_turnier/html_parser.py
+++ b/src/solo_turnier/html_parser.py
@@ -3,6 +3,17 @@ from bs4 import BeautifulSoup
import logging
import re
+class HtmlParticipant:
+ def __init__(self, name, place, finalist):
+ self.name = name
+ self.place = place
+ self.finalist = finalist
+
+class HtmlImport:
+ def __init__(self, title: str, participants: dict[int, HtmlParticipant]):
+ self.title = title
+ self.participants = participants
+
class HtmlParser:
def __init__(self):
@@ -26,11 +37,7 @@ class HtmlParser:
name = match.group(1)
number = match.group(2)
- participant = {
- 'name': name,
- 'place': place,
- 'finalist': finalist
- }
+ participant = HtmlParticipant(name, place, finalist)
participants[number] = participant
for row in rows:
@@ -55,10 +62,7 @@ class HtmlParser:
title = soup.find('div', class_='eventhead').table.tr.td.contents[0]
- ret = {
- 'participants': participants,
- 'title': title
- }
+ ret = HtmlImport(title, participants)
return ret
def guessDataFromHtmlTitle(self, title):
diff --git a/src/solo_turnier/tests/test_html_parser.py b/src/solo_turnier/tests/test_html_parser.py
index c24c6c5..6a70bf1 100644
--- a/src/solo_turnier/tests/test_html_parser.py
+++ b/src/solo_turnier/tests/test_html_parser.py
@@ -25,7 +25,12 @@ def test_extractDataFromHtml(dataProviderHtmlParser):
parser = solo_turnier.html_parser.HtmlParser()
actualResult = parser.parseString(htmlString)
- assert actualResult == expected
+ participants = {}
+ for i in actualResult.participants:
+ participants[i] = actualResult.participants[i].__dict__
+
+ assert actualResult.title == expected['title']
+ assert participants == expected['participants']
@pytest.fixture(params=range(5))
def fixture_guessDataFromTitle(request):