diff --git a/src/solo_turnier/tests/reader/expected.json b/src/solo_turnier/tests/reader/expected.json new file mode 100644 index 0000000..a6bde2b --- /dev/null +++ b/src/solo_turnier/tests/reader/expected.json @@ -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", + "" + ] + ] +} + diff --git a/src/solo_turnier/tests/reader/test.csv b/src/solo_turnier/tests/reader/test.csv new file mode 100644 index 0000000..4238d02 --- /dev/null +++ b/src/solo_turnier/tests/reader/test.csv @@ -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";"" diff --git a/src/solo_turnier/tests/test_csvReader.py b/src/solo_turnier/tests/test_csvReader.py new file mode 100644 index 0000000..109ec25 --- /dev/null +++ b/src/solo_turnier/tests/test_csvReader.py @@ -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