-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
40 lines (25 loc) · 1.08 KB
/
test.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
import unittest
from station_search import StationSearch
class TestStationSearch (unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.filename = './test_data.csv'
def test_min_temperature(self) -> None:
search = StationSearch(self.filename)
(station_id, date) = search.min_temperature()
self.assertEqual(station_id, '68')
self.assertEqual(date, '2000.542')
def test_max_fluctuation(self) -> None:
search = StationSearch(self.filename)
station_id = search.max_fluctuation()
self.assertEqual(station_id, '67')
def test_max_fluctuations_by_dates(self) -> None:
search = StationSearch(self.filename)
start, end = '2000.125', '2000.958'
station_id = search.max_fluctuation_by_dates(start, end)
self.assertEqual(station_id, '67')
start, end = '2000.375', '2000.958'
station_id = search.max_fluctuation_by_dates(start, end)
self.assertEqual(station_id, '68')
if __name__ == '__main__':
unittest.main()