示例#1
0
def test_parse_journeys(mock_http_get):
    with sample_data('02_search_results.html') as f:
        mock_http_get.return_value = f
        journeys = get_trains(Station('Bar', 'BAR'), Station('Foo', 'FOO'))
        assert_equal(5, len(journeys))
        assert_equal(
            Journey(
                depart_station=Station(name='Liverpool Lime Street',
                                       code='LIV'),
                arrive_station=Station(name='London Euston',
                                       code='EUS'),
                depart_time='19:48',
                arrive_time='22:09',
                platform=None,
                changes=0,
                status='on time'),
            journeys[0])

        assert_equal(
            Journey(
                depart_station=Station(name='Liverpool Lime Street',
                                       code='LIV'),
                arrive_station=Station(name='London Euston',
                                       code='EUS'),
                depart_time='23:43',
                arrive_time='07:38',
                platform=None,
                changes=2,
                status=''),
            journeys[4])
示例#2
0
def test_newlines_removed_from_status(mock_http_get):
    with sample_data('05_journey_split_status.html') as f:
        mock_http_get.return_value = f
        journeys = get_trains(Station('Bar', 'BAR'), Station('Foo', 'FOO'))
        assert_equal('disrupted', journeys[0].status)
示例#3
0
def _test_split_table(mock_http_get):
    with sample_data('03_split_tables.html') as f:
        mock_http_get.return_value = f
        journeys = get_trains(Station('Bar', 'BAR'), Station('Foo', 'FOO'))
        assert_equal(None, journeys)