-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_Team.py
47 lines (38 loc) · 1.53 KB
/
test_Team.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from TeamTfrrs import Team
from AthleteTfrrs import Athlete
import unittest
from concurrent.futures import ThreadPoolExecutor
class TestTfrrsApi(unittest.TestCase):
@classmethod
def setUpClass(cls):
info = [("NY", "M", "RPI"), ("NY", "F", "RPI")]
with ThreadPoolExecutor(max_workers=2) as executor:
genders = []
for result in executor.map(lambda params: Team(*params), info):
genders.append(result)
cls.Men, cls.Women = genders
# Make sure both men and women have the correct number of athletes
def test_numberOfAthletes(self):
self.assertEqual(82, len(self.Men.getRoster()))
self.assertEqual(52, len(self.Women.getRoster()))
# def test_topMarks(self):
# pass
def test_visuallyAllPersonalBests(self):
show = True
if show:
print()
IDs = list(self.Women.getRoster()["Athlete ID"].values)
Names = list(self.Women.getRoster()["NAME"].values)
Athletes = []
with ThreadPoolExecutor(max_workers=len(IDs)) as executor:
for result in executor.map(Athlete, IDs):
Athletes.append(result)
personalBests = [
{name: athlete.getPersonalRecords().keys()}
for name, athlete in zip(Names, Athletes)
]
for athlete in personalBests:
for key in athlete:
print("{}\n{}\n".format(key, list(athlete[key])))
if __name__ == "__main__":
unittest.main()