def test_prune_destination(): ir = IrishRailRTPI() only_bray = ir._prune_trains(trains, destination="Bray") assert len(only_bray) == 1 for train in only_bray: assert train["destination"] == "Bray" only_greystones = ir._prune_trains(trains, destination="Greystones") assert len(only_greystones) == 2 for train in only_greystones: assert train["destination"] == "Greystones"
def test_prune_direction(): ir = IrishRailRTPI() only_southbound = ir._prune_trains(trains, direction="Southbound") assert len(only_southbound) == 2 for train in only_southbound: assert train["direction"] == "Southbound" only_northbound = ir._prune_trains(trains, direction="Northbound") assert len(only_northbound) == 1 for train in only_northbound: assert train["direction"] == "Northbound"
def test_prune_both(): ir = IrishRailRTPI() only_bray = ir._prune_trains(trains, direction="Northbound", destination="Bray") assert len(only_bray) == 1 for train in only_bray: assert train['direction'] == "Northbound" assert train["destination"] == "Bray" only_greystones = ir._prune_trains(trains, direction="Southbound", destination="Greystones") assert len(only_greystones) == 2 for train in only_greystones: assert train['direction'] == "Southbound" assert train["destination"] == "Greystones" no_trains = ir._prune_trains(trains, direction="Northbound", destination="Greystones") assert len(no_trains) == 0