Aed test for CSV reader

This commit is contained in:
Christian Wolf 2022-11-13 19:08:43 +01:00
parent 9d88d09a97
commit d17379e254
3 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,149 @@
{
"header": [
"\ufeffTurniernr", "Datum", "Gruppe", "Klasse", "Art", "StNr", "VNamePartner", "NNamePartner",
"VNamePartnerin", "NNamePartnerin", "Club", "LTV", "Platzvon", "Platzbis", "Punkte", "GruppePaar", "KlassePaar", "Hinweis"
],
"data": [
[
"",
"19.06.2022",
"Kin.",
"Newc./Beg.",
"Cha Cha",
"2",
"Max",
"Mustermann 1",
"",
"",
"Club A",
"TRP",
"1",
"1",
"0",
"Kin.",
"Beginner",
""
],
[
"",
"19.06.2022",
"Kin.",
"Newc./Beg.",
"Cha Cha",
"3",
"Max",
"Mustermann 2",
"",
"",
"Club B",
"SLT",
"3",
"3",
"0",
"Kin.",
"Beginner",
""
],
[
"",
"19.06.2022",
"Kin.",
"Newc./Beg.",
"Cha Cha",
"6",
"Max",
"Mustermann 3",
"",
"",
"Club C",
"TNW",
"2",
"2",
"0",
"Kin.",
"Beginner",
""
],
[
"",
"19.06.2022",
"Kin.",
"Newc./Beg.",
"Cha Cha",
"8",
"Max",
"Mustermann 4",
"",
"",
"Club D",
"TRP",
"1",
"1",
"0",
"Kin.",
"Newcomer",
""
],
[
"",
"19.06.2022",
"Jun.",
"Beg./Adv.",
"Cha Cha",
"9",
"Maxime",
"Musterfrau 1",
"",
"",
"Club E",
"TRP",
"1",
"1",
"0",
"Jun.",
"Advanced",
""
],
[
"",
"19.06.2022",
"Jun.",
"Beg./Adv.",
"Cha Cha",
"10",
"Maxime",
"Musterfrau 2",
"",
"",
"Club C",
"TRP",
"2",
"2",
"0",
"Jun.",
"Advanced",
""
],
[
"",
"19.06.2022",
"Jun.",
"Beg./Adv.",
"Cha Cha",
"11",
"Maxime",
"Musterfrau 3",
"",
"",
"Club D",
"TRP",
"5",
"5",
"0",
"Jun.",
"Advanced",
""
]
]
}

View File

@ -0,0 +1,8 @@
Turniernr;Datum;Gruppe;Klasse;Art;StNr;VNamePartner;NNamePartner;VNamePartnerin;NNamePartnerin;Club;LTV;Platzvon;Platzbis;Punkte;GruppePaar;KlassePaar;Hinweis
;19.06.2022;"Kin.";"Newc./Beg.";"Cha Cha";2;"Max";"Mustermann 1";"";"";"Club A";"TRP";1;1;0;"Kin.";"Beginner";""
;19.06.2022;"Kin.";"Newc./Beg.";"Cha Cha";3;"Max";"Mustermann 2";"";"";"Club B";"SLT";3;3;0;"Kin.";"Beginner";""
;19.06.2022;"Kin.";"Newc./Beg.";"Cha Cha";6;"Max";"Mustermann 3";"";"";"Club C";"TNW";2;2;0;"Kin.";"Beginner";""
;19.06.2022;"Kin.";"Newc./Beg.";"Cha Cha";8;"Max";"Mustermann 4";"";"";"Club D";"TRP";1;1;0;"Kin.";"Newcomer";""
;19.06.2022;"Jun.";"Beg./Adv.";"Cha Cha";9;"Maxime";"Musterfrau 1";"";"";"Club E";"TRP";1;1;0;"Jun.";"Advanced";""
;19.06.2022;"Jun.";"Beg./Adv.";"Cha Cha";10;"Maxime";"Musterfrau 2";"";"";"Club C";"TRP";2;2;0;"Jun.";"Advanced";""
;19.06.2022;"Jun.";"Beg./Adv.";"Cha Cha";11;"Maxime";"Musterfrau 3";"";"";"Club D";"TRP";5;5;0;"Jun.";"Advanced";""
1 Turniernr Datum Gruppe Klasse Art StNr VNamePartner NNamePartner VNamePartnerin NNamePartnerin Club LTV Platzvon Platzbis Punkte GruppePaar KlassePaar Hinweis
2 19.06.2022 Kin. Newc./Beg. Cha Cha 2 Max Mustermann 1 Club A TRP 1 1 0 Kin. Beginner
3 19.06.2022 Kin. Newc./Beg. Cha Cha 3 Max Mustermann 2 Club B SLT 3 3 0 Kin. Beginner
4 19.06.2022 Kin. Newc./Beg. Cha Cha 6 Max Mustermann 3 Club C TNW 2 2 0 Kin. Beginner
5 19.06.2022 Kin. Newc./Beg. Cha Cha 8 Max Mustermann 4 Club D TRP 1 1 0 Kin. Newcomer
6 19.06.2022 Jun. Beg./Adv. Cha Cha 9 Maxime Musterfrau 1 Club E TRP 1 1 0 Jun. Advanced
7 19.06.2022 Jun. Beg./Adv. Cha Cha 10 Maxime Musterfrau 2 Club C TRP 2 2 0 Jun. Advanced
8 19.06.2022 Jun. Beg./Adv. Cha Cha 11 Maxime Musterfrau 3 Club D TRP 5 5 0 Jun. Advanced

View File

@ -0,0 +1,13 @@
import solo_turnier.reader
import os
import json
def test_import():
fileName = os.path.join(os.path.dirname(__file__), 'reader', 'test.csv')
reader = solo_turnier.reader.AllResultReader(fileName)
ret = reader.readFile()
with open(os.path.join(os.path.dirname(__file__), 'reader', 'expected.json')) as fp:
expected = json.load(fp)
assert ret == expected