Example #1
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])
Example #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])
Example #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
Example #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))
Example #5
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))
Example #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))
Example #7
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])
Example #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])
Example #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])
Example #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'
Example #11
0
 def test_stop_times(self):
   agency = util.preload_agency()
   assert len(agency.stop_times()) == 28
Example #12
0
 def test_stop(self):
   agency = util.preload_agency()
   assert agency.stop('NANAA')
Example #13
0
 def test_trip(self):
   agency = util.preload_agency()
   assert agency.trip('AB1')
Example #14
0
 def test_trips(self):
   agency = util.preload_agency()
   assert len(agency.trips()) == 11
Example #15
0
 def test_trips(self):
     agency = util.preload_agency()
     assert len(agency.trips()) == 11
Example #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)
Example #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)
Example #18
0
 def test_routes(self):
     agency = util.preload_agency()
     assert len(agency.routes()) == 5
Example #19
0
 def test_stop_times(self):
     agency = util.preload_agency()
     assert len(agency.stop_times()) == 28
Example #20
0
 def test_stop(self):
     agency = util.preload_agency()
     assert agency.stop('NANAA')
Example #21
0
 def test_trip(self):
     agency = util.preload_agency()
     assert agency.trip('AB1')
Example #22
0
 def test_stop_times(self):
   agency = util.preload_agency()
   entity = agency.trip(self.expect['trip_id'])
   assert len(entity.stop_times()) == 5
Example #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)
Example #24
0
 def test_routes(self):
   agency = util.preload_agency()
   assert len(agency.routes()) == 5
Example #25
0
 def test_route(self):
   agency = util.preload_agency()
   assert agency.route('AB')
Example #26
0
 def test_route(self):
     agency = util.preload_agency()
     assert agency.route('AB')
Example #27
0
 def test_stops(self):
   agency = util.preload_agency()
   route = agency.route(self.expect['route_id'])
   assert len(route.stops()) == 2
Example #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'