Пример #1
0
    def test_rest_day(self):
        france = country.France()
        limoges = Location("Limoges", france)
        rest_day = RestDay(datetime(2018, 7, 6), limoges)
        assert rest_day.route(france) == ',6 July,Rest day,Limoges'

        switzerland = country.Switzerland()
        basel = Location("Basel", switzerland)
        swiss_rest_day = RestDay(datetime(2018, 7, 6), basel)
        assert swiss_rest_day.route(
            france) == ',6 July,Rest day,Basel (Switzerland)'

        transfer_day = RestDay(datetime(2018, 7, 6))
        france = country.France()
        assert transfer_day.route(france) == ',6 July,Rest day'
Пример #2
0
 def test_dauphine_post_2010(self):
     france = country.France()
     valence = Location("Valence", france)
     prologue = Prologue(datetime(2018, 6, 3), valence, valence, 6.6)
     dauphine = Dauphine()
     dauphine.add_stage(prologue)
     assert dauphine.name == "Critérium du Dauphiné"
Пример #3
0
def french_col(name,
               height,
               length=None,
               average_gradient=None,
               maximum_gradient=None):
    return Col(name, country.France(), height, length, average_gradient,
               maximum_gradient)
Пример #4
0
 def test_country(self):
     assert country.Andorra().name         == "Andorra"
     assert country.Austria().name         == "Austria"
     assert country.Belgium().name         == "Belgium"
     assert country.Croatia().name         == "Croatia"
     assert country.Denmark().name         == "Denmark"
     assert country.Fiume().name           == "Free State of Fiume"
     assert country.France().name          == "France"
     assert country.Germany().name         == "Germany"
     assert country.Greece().name          == "Greece"
     assert country.Ireland().name         == "Ireland"
     assert country.Israel().name          == "Israel"
     assert country.Italy().name           == "Italy"
     assert country.Luxembourg().name      == "Luxembourg"
     assert country.Monaco().name          == "Monaco"
     assert country.Netherlands().name     == "Netherlands"
     assert country.NorthernIreland().name == "Northern Ireland"
     assert country.Portugal().name        == "Portugal"
     assert country.SanMarino().name       == "San Marino"
     assert country.Slovenia().name        == "Slovenia"
     assert country.Spain().name           == "Spain"
     assert country.Switzerland().name     == "Switzerland"
     assert country.UnitedKingdom().name   == "United Kingdom"
     assert country.VaticanCity().name     == "Vatican City"
     assert country.WestGermany().name     == "West Germany"
     assert country.Yugoslavia().name      == "Yugoslavia"
    def test_stage_race_builder(self):

        france  = country.France()
        amiens  = Location("Amiens", france)
        boulogne = Location("Boulogne", france)
        grenoble = Location("Grenoble", france)
        lehavre = Location("Le Havre", france)
        letouquet = Location("Le Touquet", france)
        morzine = Location("Morzine", france)
        limoges = Location("Limoges", france)
        nantes  = Location("Nantes", france)
        paris   = Location("Paris", france)
        quimper = Location("Quimper", france)
        rennes  = Location("Rennes", france)
        rouen   = Location("Rouen", france)
        tours   = Location("Tours", france)

        builder = StageRaceBuilder(TourDeFrance(), datetime(2018,7,1))
        builder.prologue(paris, paris, 6.6)
        builder.criterium(paris, 256)
        builder.road_stage(paris, tours, 265)
        builder.road_stage(tours, limoges, 248)
        builder.rest_day(limoges)
        builder.road_stage(limoges, nantes, 259)
        builder.out_and_back_team_time_trial(nantes, 48)
        builder.road_stage(nantes, quimper, 289)
        builder.road_stage(quimper, rennes, 239)
        builder.out_and_back_individual_time_trial(rennes, 65)
        builder.enable_split_stages()
        builder.criterium(lehavre, 100)
        builder.road_stage(lehavre, rouen, 150)
        builder.disable_split_stages()
        builder.road_stage(rouen, amiens, 187.2)
        builder.enable_morning_stage()
        builder.road_stage(amiens, boulogne, 189)
        builder.individual_time_trial(boulogne, letouquet, 40)
        builder.rest_day(grenoble)
        builder.road_stage(grenoble, morzine, 257.3)
        tdf = builder.build()

        route = """P,1 July,Paris,6.6 km,Individual time trial
        1,2 July,Paris,256.0 km,Road stage
        2,3 July,Paris to Tours,265.0 km,Road stage
        3,4 July,Tours to Limoges,248.0 km,Road stage
        ,5 July,Rest day,Limoges
        4,6 July,Limoges to Nantes,259.0 km,Road stage
        5,7 July,Nantes,48.0 km,Team time trial
        6,8 July,Nantes to Quimper,289.0 km,Road stage
        7,9 July,Quimper to Rennes,239.0 km,Road stage
        8,10 July,Rennes,65.0 km,Individual time trial
        9a,11 July,Le Havre,100.0 km,Road stage
        9b,11 July,Le Havre to Rouen,150.0 km,Road stage
        10,12 July,Rouen to Amiens,187.2 km,Road stage
        11,13 July,Amiens to Boulogne,189.0 km,Road stage
        12,13 July,Boulogne to Le Touquet,40.0 km,Individual time trial
        ,14 July,Rest day,Grenoble
        13,15 July,Grenoble to Morzine,257.3 km,Road stage"""

        assert tdf.route == inspect.cleandoc(route)
Пример #6
0
 def test_dauphine_pre_2010(self):
     france = country.France()
     nancy = Location("Nancy", france)
     itt = IndividualTimeTrial(datetime(2009, 6, 7), "1", nancy, nancy,
                               12.1)
     dauphine = Dauphine()
     dauphine.add_stage(itt)
     assert dauphine.name == "Critérium du Dauphiné Libéré"
Пример #7
0
    def test_location(self):

        belgium = country.Belgium()
        france = country.France()

        paris = Location("Paris", france)
        nantes = Location("Nantes", france)

        assert paris.qualified_location(france) == "Paris"
        assert paris.qualified_location(belgium) == "Paris (France)"
Пример #8
0
 def test_stage_id(self):
     france = country.France()
     paris = Location("Paris", france)
     tours = Location("Tours", france)
     prologue = Prologue(datetime(2018, 7, 1), paris, paris, 6.7)
     prologue_ttt = PrologueTeamTimeTrial(datetime(2018, 7, 1), paris,
                                          paris, 10.8)
     road_stage = RoadStage(datetime(2018, 7, 1), "1", paris, tours, 265)
     assert prologue.id == "P"
     assert prologue_ttt.id == "P"
     assert road_stage.id == "1"
Пример #9
0
    def test_route(self):
        france = country.France()
        lemans = Location("Le Mans", france)
        criterium = Criterium(datetime(2018, 7, 7), "4", lemans, 234)
        assert criterium.route(
            france) == '4,7 July,Le Mans,234.0 km,Road stage'

        nantes = Location("Nantes", france)
        limoges = Location("Limoges", france)
        road_stage = RoadStage(datetime(2018, 7, 7), "1", nantes, limoges, 257)
        assert road_stage.route(
            france) == '1,7 July,Nantes to Limoges,257.0 km,Road stage'
Пример #10
0
    def test_stage_race_length(self):

        france = country.France()
        paris = Location("Paris", france)
        tours = Location("Tours", france)

        july_1st = datetime(2018, 7, 1)
        july_2nd = datetime(2018, 7, 2)
        july_3rd = datetime(2018, 7, 3)
        july_4th = datetime(2018, 7, 4)
        july_5th = datetime(2018, 7, 5)

        prologue = Prologue(july_1st, paris, paris, 6.6)
        stage1 = RoadStage(july_2nd, "1", paris, tours, 256)
        stage2 = Criterium(july_3rd, "2", tours, 237)
        rest_day = RestDay(july_4th, tours)
        stage3 = TeamTimeTrial(july_5th, "3", tours, tours, 35.7)

        tdf = TourDeFrance()
        tdf.add_stage(prologue)
        tdf.add_stage(stage1)
        tdf.add_stage(stage2)
        tdf.add_stage(rest_day)
        tdf.add_stage(stage3)

        assert len(tdf) == 4

        distance = tdf.prologue_kilometres + \
            tdf.road_stage_kilometres + \
            tdf.team_time_trial_kilometres + \
            tdf.individual_time_trial_kilometres

        assert tdf.distance == distance

        assert tdf.number_of_road_stages == 2
        assert tdf.number_of_team_time_trials == 1
        assert tdf.number_of_individual_time_trials == 0
        assert tdf.number_of_rest_days == 1

        assert tdf.first_stage == prologue
        assert tdf.depart == prologue.start
        assert tdf.last_stage == stage3
        assert tdf.arrive == stage3.finish
Пример #11
0
    def test_stage_description(self):
        france = country.France()
        paris = Location("Paris", france)
        nantes = Location("Nantes", france)
        limoges = Location("Limoges", france)
        lemans = Location("Le Mans", france)

        prologue = Prologue(datetime(2018, 7, 1), paris, paris, 7.8)
        road_stage = RoadStage(datetime(2018, 7, 2), "1", nantes, limoges, 257)
        team_time_trial = TeamTimeTrial(datetime(2018, 7, 3), "2", nantes,
                                        nantes, 56.8)
        individual_time_trial = IndividualTimeTrial(datetime(2018, 7, 4), "3",
                                                    limoges, limoges, 32.4)
        criterium = Criterium(datetime(2018, 7, 5), "4", lemans, 234)

        assert prologue.description == "Individual time trial"
        assert road_stage.description == "Road stage"
        assert team_time_trial.description == "Team time trial"
        assert individual_time_trial.description == "Individual time trial"
        assert criterium.description == "Road stage"
Пример #12
0
 def __init__(self):
     super().__init__("Critérium du Dauphiné", country.France()) 
Пример #13
0
 def __init__(self):
     super().__init__("Paris-Nice", country.France()) 
Пример #14
0
 def __init__(self):
     super().__init__("Tour de France", country.France())