-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelc_test.py
61 lines (52 loc) · 2.16 KB
/
elc_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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""Unit test for the elcpy module."""
import unittest
import wsdotelc
class Test_unittest(unittest.TestCase):
def setUp(self):
self.elc = wsdotelc.Elc()
def test_routes(self):
"""Test the retrieval of `elcpy.Elc.routes`."""
routes = self.elc.routes
self.assertTrue(isinstance(routes, dict), "Returned routes object is a dict.")
self.assertTrue(
isinstance(self.elc._routes, dict), "Route dict has been cached."
)
def test_find_route_locations(self):
"""Test the `elcpy.Elc.find_route_locations` function."""
# locations = (elcpy.RouteLocation(route="005", arm=5, reference_date="12/31/2013"))
# Create a set of locations.
locations = (wsdotelc.RouteLocation(Route="005", Arm=5),)
out_locations = self.elc.find_route_locations(locations, "12/31/2013")
self.assertEqual(len(out_locations), 1, "Result has single element.")
self.assertIsInstance(
out_locations[0],
wsdotelc.RouteLocation,
"The first element in the returned array is an `elcpy.RouteLocation`.",
)
def test_find_nearest_route_location(self):
"""Test the `elcpy.Elc.find_dearest_route_locations` function."""
points = [1087403.28714286, 136623.00728571415]
out_locations = self.elc.find_nearest_route_locations(
points, "12/31/2013", 200, 2927
)
self.assertEqual(
1,
len(out_locations),
"Input and output loctions should have the same number of elements.",
)
self.assertIsInstance(
out_locations[0],
wsdotelc.RouteLocation,
"The first element in the returned array is an `elcpy.RouteLocation`.",
)
self.assertListEqual(
[out_locations[0].Route, out_locations[0].Arm],
["005", 5],
"Test for expected Route ID and ARM values.",
)
# def test_A(self):
# self.fail("Not implemented")
if __name__ == "__main__":
unittest.main()
# suite = unittest.TestLoader().loadTestsFromTestCase(Test_unittest)
# unittest.TextTestRunner(verbosity=2).run(suite)