def test_point(self):
     agency = util.preload_agency()
     point = agency.point()
     expect = [-116.76705100000001, 36.670485]
     for i, j in zip(point, expect):
         self.assertAlmostEqual(i, j)
     self.assertAlmostEqual(point[0], expect[0])
     self.assertAlmostEqual(point[1], expect[1])
Exemple #2
0
 def test_point(self):
   agency = util.preload_agency()
   point = agency.point()
   expect = [-116.76705100000001, 36.670485]
   for i,j in zip(point, expect):
     self.assertAlmostEqual(i,j)
   self.assertAlmostEqual(point[0], expect[0])
   self.assertAlmostEqual(point[1], expect[1])
Exemple #3
0
 def test_stop_sequence(self):
   agency = util.preload_agency()
   entity = agency.trip(self.expect['trip_id'])
   stop_sequence = entity.stop_sequence()
   assert len(stop_sequence) == 5
   expect = ['1', '2', '3', '4', '5']
   for i,j in zip(stop_sequence, expect):
     assert i.get('stop_sequence') == j
Exemple #4
0
 def test_json(self):
   agency = util.preload_agency()
   entity = agency.route(self.expect['route_id'])
   data = entity.json()
   assert data['name'] == entity.name()
   assert data['type'] == 'Feature'
   assert data['geometry']['type'] == 'MultiLineString'
   # Round trip
   assert json.loads(json.dumps(data))
 def test_json(self):
     # Basic checks for JSON sanity.
     agency = util.preload_agency()
     data = agency.json()
     assert data['name'] == 'Demo Transit Authority'
     assert 'geometry' in data
     assert 'bbox' in data
     assert len(data['features']) == 9
     # Round trip
     assert json.loads(json.dumps(data))
Exemple #6
0
 def test_json(self):
   # Basic checks for JSON sanity.
   agency = util.preload_agency()
   data = agency.json()
   assert data['name'] == 'Demo Transit Authority'
   assert 'geometry' in data
   assert 'bbox' in data
   assert len(data['features']) == 9
   # Round trip
   assert json.loads(json.dumps(data))
 def test_geometry(self):
     agency = util.preload_agency()
     geometry = agency.geometry()
     # a beast...
     expect = [(-117.133162, 36.425288), (-116.40094, 36.641496),
               (-116.751677, 36.915682), (-116.76821, 36.914893),
               (-116.81797, 36.88108), (-117.133162, 36.425288)]
     assert geometry['type'] == 'Polygon'
     for i, j in zip(geometry['coordinates'][0], expect):
         self.assertAlmostEqual(i[0], j[0])
         self.assertAlmostEqual(i[1], j[1])
Exemple #8
0
 def test_geometry(self):
   agency = util.preload_agency()
   geometry = agency.geometry()
   # a beast...
   expect = [
     (-117.133162, 36.425288),
     (-116.40094, 36.641496),
     (-116.751677, 36.915682),
     (-116.76821, 36.914893),
     (-116.81797, 36.88108),
     (-117.133162, 36.425288)
   ]
   assert geometry['type'] == 'Polygon'
   for i,j in zip(geometry['coordinates'][0], expect):
     self.assertAlmostEqual(i[0],j[0])
     self.assertAlmostEqual(i[1],j[1])
Exemple #9
0
 def test_geometry(self):
   agency = util.preload_agency()
   route = agency.route(self.expect['route_id'])
   geometry = route.geometry()
   assert geometry['type'] == 'MultiLineString'
   # Line 1
   expect = [
     (-116.784582, 36.868446),
     (-116.81797, 36.88108)]
   for i,j in zip(geometry['coordinates'][0], expect):
     self.assertAlmostEqual(i[0],j[0])
     self.assertAlmostEqual(i[1],j[1])
   # Line 2
   expect = [
     (-116.81797, 36.88108),
     (-116.784582, 36.868446)
   ]
   for i,j in zip(geometry['coordinates'][1], expect):
     self.assertAlmostEqual(i[0],j[0])
     self.assertAlmostEqual(i[1],j[1])
Exemple #10
0
 def test_routes(self):
   agency = util.preload_agency()
   entity = agency.stop(self.expect['stop_id'])
   routes = entity.routes()
   assert len(routes) == 1
   assert list(routes)[0].id() == 'BFC'
Exemple #11
0
 def test_stop_times(self):
   agency = util.preload_agency()
   assert len(agency.stop_times()) == 28
Exemple #12
0
 def test_stop(self):
   agency = util.preload_agency()
   assert agency.stop('NANAA')
Exemple #13
0
 def test_trip(self):
   agency = util.preload_agency()
   assert agency.trip('AB1')
Exemple #14
0
 def test_trips(self):
   agency = util.preload_agency()
   assert len(agency.trips()) == 11
Exemple #15
0
 def test_trips(self):
     agency = util.preload_agency()
     assert len(agency.trips()) == 11
Exemple #16
0
 def test_bbox(self):
   agency = util.preload_agency()
   route = agency.route(self.expect['route_id'])
   expect = [-116.81797, 36.868446, -116.784582, 36.88108]
   for i,j in zip(route.bbox(), expect):
     self.assertAlmostEqual(i,j)
Exemple #17
0
 def test_bbox(self):
   agency = util.preload_agency()
   expect = [-117.133162, 36.425288, -116.40094, 36.915682]
   for i,j in zip(agency.bbox(), expect):
     self.assertAlmostEqual(i,j)
Exemple #18
0
 def test_routes(self):
     agency = util.preload_agency()
     assert len(agency.routes()) == 5
Exemple #19
0
 def test_stop_times(self):
     agency = util.preload_agency()
     assert len(agency.stop_times()) == 28
Exemple #20
0
 def test_stop(self):
     agency = util.preload_agency()
     assert agency.stop('NANAA')
Exemple #21
0
 def test_trip(self):
     agency = util.preload_agency()
     assert agency.trip('AB1')
Exemple #22
0
 def test_stop_times(self):
   agency = util.preload_agency()
   entity = agency.trip(self.expect['trip_id'])
   assert len(entity.stop_times()) == 5
Exemple #23
0
 def test_bbox(self):
     agency = util.preload_agency()
     expect = [-117.133162, 36.425288, -116.40094, 36.915682]
     for i, j in zip(agency.bbox(), expect):
         self.assertAlmostEqual(i, j)
Exemple #24
0
 def test_routes(self):
   agency = util.preload_agency()
   assert len(agency.routes()) == 5
Exemple #25
0
 def test_route(self):
   agency = util.preload_agency()
   assert agency.route('AB')
Exemple #26
0
 def test_route(self):
     agency = util.preload_agency()
     assert agency.route('AB')
Exemple #27
0
 def test_stops(self):
   agency = util.preload_agency()
   route = agency.route(self.expect['route_id'])
   assert len(route.stops()) == 2
Exemple #28
0
 def test_routes(self):
     agency = util.preload_agency()
     entity = agency.stop(self.expect['stop_id'])
     routes = entity.routes()
     assert len(routes) == 1
     assert list(routes)[0].id() == 'BFC'