2023-11-28 17:41:12 +01:00
|
|
|
|
|
|
|
import csv
|
2023-11-28 18:37:43 +01:00
|
|
|
import unittest
|
2023-11-28 17:41:12 +01:00
|
|
|
from unittest import mock
|
|
|
|
|
|
|
|
|
2023-11-28 18:37:43 +01:00
|
|
|
def GainPossition(n,file):
|
|
|
|
ret = ""
|
|
|
|
with open(file, newline='') as f:
|
|
|
|
reader = csv.reader(f)
|
|
|
|
for i in range(1,n):
|
|
|
|
ret = next(reader)
|
|
|
|
return ret
|
2023-11-28 17:41:12 +01:00
|
|
|
|
|
|
|
|
2023-11-28 18:37:43 +01:00
|
|
|
class modelAndVisTest(unittest.TestCase):
|
|
|
|
|
|
|
|
def modelAndVisTest(self):
|
|
|
|
|
|
|
|
#Wiersze ze zbioru:
|
|
|
|
# Test sprawdzający czy funkcja wyciąga właściwe ustawienie z pliku
|
2023-11-28 17:41:12 +01:00
|
|
|
|
2023-11-28 18:37:43 +01:00
|
|
|
file = "test_dataSet.csv"
|
2023-11-28 17:41:12 +01:00
|
|
|
|
2023-11-28 18:37:43 +01:00
|
|
|
wiersz_1_5 = [113.0, 38.0]
|
|
|
|
|
|
|
|
wiersz_1_2 = "Right Center Forward"
|
|
|
|
|
|
|
|
wiersz_7_3 = "Open Play"
|
|
|
|
|
|
|
|
wiersz_23_4 = "Off T"
|
|
|
|
|
|
|
|
|
|
|
|
# Pobranie pozycji za pomocą testowanej funkcji
|
|
|
|
|
|
|
|
p_wiersz_1 = GainPossition(1,file)
|
|
|
|
|
|
|
|
p_wiersz_7 = GainPossition(7,file)
|
|
|
|
|
|
|
|
p_wiersz_23 = GainPossition(23,file)
|
|
|
|
|
|
|
|
self.assertEquals(wiersz_1_5,p_wiersz_1[5])
|
|
|
|
self.assertEquals(wiersz_1_2,p_wiersz_1[2])
|
|
|
|
self.assertEquals(wiersz_7_3,p_wiersz_1[3])
|
|
|
|
self.assertEquals(wiersz_23_4,p_wiersz_1[4])
|
|
|
|
|
|
|
|
unittest.main()
|