def test_has_linkRefId_with_stop_which_has_linkRefId(): a = Stop(id='0', x=-0.14910908709500162, y=51.52370573323939, epsg='epsg:4326') a.add_additional_attributes({'linkRefId': '1234'}) assert a.has_linkRefId()
def test_add_additional_attributes_to_stops(): a = Stop(id='0', x=528504.1342843144, y=182155.7435136598, epsg='epsg:27700', name='Brunswick Place (Stop P)') a.add_additional_attributes({'isBlocking': True}) assert a.isBlocking == True
def test_has_correctly_ordered_route_with_stop_missing_linkrefid(): a = Stop(id='1', x=4, y=2, epsg='epsg:27700') a.add_additional_attributes({'linkRefId': '10'}) b = Stop(id='2', x=4, y=2, epsg='epsg:27700') b.add_additional_attributes({'linkRefId': '20'}) c = Stop(id='3', x=4, y=2, epsg='epsg:27700') r = Route(route_short_name='name', mode='bus', stops=[a, b, c], trips={'trip_id': ['1', '2'], 'trip_departure_time': ['10:00:00', '20:00:00'], 'vehicle_id': ['veh_1_bus', 'veh_2_bus']}, arrival_offsets=['1', '2'], departure_offsets=['1', '2'], route=['10', '15', '30', '25', '20'], id='1') assert not r.has_correctly_ordered_route()
def test_has_correctly_ordered_route_with_no_route(): a = Stop(id='1', x=4, y=2, epsg='epsg:27700') a.add_additional_attributes({'linkRefId': '10'}) b = Stop(id='2', x=4, y=2, epsg='epsg:27700') b.add_additional_attributes({'linkRefId': '20'}) c = Stop(id='3', x=4, y=2, epsg='epsg:27700') c.add_additional_attributes({'linkRefId': '30'}) r = Route(route_short_name='name', mode='bus', stops=[a, b, c], trips={ '1': '1', '2': '2' }, arrival_offsets=['1', '2'], departure_offsets=['1', '2'], route=[], id='1') assert not r.has_correctly_ordered_route()