-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_common.py
44 lines (29 loc) · 1.34 KB
/
test_common.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
import unittest
import common
import nfl.parser as nfl
import csv
class TestCommon(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(TestCommon, cls).setUpClass()
with open("input\\nfl\\2014.csv", 'r') as input_f:
rows = csv.reader(input_f)
lst = list(rows)
cls.first = nfl.NFLGame(lst[0])
cls.second = nfl.NFLGame(lst[1])
def test_parsed_firstrow_matches(self):
self.assertEqual(1, self.first.week, "week should match")
self.assertEqual("Seattle Seahawks", self.first.home, "home team should match")
self.assertEqual("Green Bay Packers", self.first.away, "away team should match")
self.assertEqual(36, self.first.homePts, "home team pts should match")
self.assertEqual(16, self.first.awayPts, "away team pts should match")
self.assertEqual(1, self.first.homeWin, "home is a winner")
def test_parsed_secondrow_matches(self):
self.assertEqual(1, self.second.week, "week should match")
self.assertEqual("St. Louis Rams", self.second.home, "home team should match")
self.assertEqual("Minnesota Vikings", self.second.away, "away team should match")
self.assertEqual(6, self.second.homePts, "home team pts should match")
self.assertEqual(34, self.second.awayPts, "away team pts should match")
self.assertEqual(0, self.second.homeWin, "home is a winner")
if __name__ == '__main__':
unittest.main()