Example #1
0
def qualifier_nontransport_duration_with_tc_test():
    journey = response_pb2.Journey()
    journey.arrival_date_time = str_to_time_stamp('20140825T113224')
    journey.duration = 2620
    journey.nb_transfers = 2
    journey.sections.add()
    journey.sections.add()
    journey.sections.add()
    journey.sections.add()
    journey.sections.add()
    journey.sections.add()

    journey.sections[0].type = response_pb2.CROW_FLY
    journey.sections[0].duration = 796

    journey.sections[1].type = response_pb2.PUBLIC_TRANSPORT
    journey.sections[1].duration = 328

    journey.sections[2].type = response_pb2.TRANSFER
    journey.sections[2].duration = 418

    journey.sections[3].type = response_pb2.WAITING
    journey.sections[3].duration = 719

    journey.sections[4].type = response_pb2.PUBLIC_TRANSPORT
    journey.sections[4].duration = 175

    journey.sections[-1].type = response_pb2.STREET_NETWORK
    journey.sections[-1].duration = 864

    assert qualifier.get_nontransport_duration(journey) == 2797
Example #2
0
def qualifier_nontransport_duration_only_walk_test():
    journey = response_pb2.Journey()
    journey.arrival_date_time = str_to_time_stamp('20140825T113224')
    journey.duration = 2620
    journey.nb_transfers = 1
    journey.sections.add()
    journey.sections.add()
    journey.sections.add()

    journey.sections[0].type = response_pb2.CROW_FLY
    journey.sections[0].duration = 796

    journey.sections[1].type = response_pb2.TRANSFER
    journey.sections[1].duration = 328

    journey.sections[-1].type = response_pb2.STREET_NETWORK
    journey.sections[-1].duration = 864

    assert qualifier.get_nontransport_duration(journey) == 1988