Exemplo n.º 1
0
def test_constructor():
    init()
    stadium = Stadium("Motoarena", poland, apator, 20000, 99)
    track = Track(stadium, 300, 30, 45)
    assert track.stadium == stadium
    assert track.length == 300
    assert track.first_corner_angle == 30
    assert track.second_corner_angle == 45
Exemplo n.º 2
0
def test_eq():
    init()
    apator2 = Team(league, ekstraliga, "Apator2", torun, poland, 99, None)

    stadium1 = Stadium("Motoarena", poland, apator, 20000, 99)
    stadium2 = Stadium("Motoarena2", poland, apator, 20000, 99)
    stadium3 = Stadium("Motoarena", poland, apator2, 20000, 99)
    stadium4 = Stadium("Motoarena", poland, apator, 2000, 99)
    stadium5 = Stadium("Motoarena", poland, apator, 20000, 9)

    # note: equals only name
    assert stadium1 != stadium2
    assert stadium1 == stadium3
    assert stadium1 == stadium4
    assert stadium1 == stadium5
    assert stadium3 == stadium4
    assert stadium3 == stadium5
    assert stadium2 != stadium3
Exemplo n.º 3
0
def test_eq():
    init()
    stadium1 = Stadium("Motoarena", poland, apator, 20000, 99)
    stadium2 = Stadium("Motoarena2", poland, apator, 20000, 99)

    track1 = Track(stadium1, 300, 30, 45)
    track2 = Track(stadium2, 300, 30, 45)

    track_preparation1 = TrackPreparation(track1, 90, 50)
    track_preparation2 = TrackPreparation(track2, 90, 50)
    track_preparation3 = TrackPreparation(track1, 80, 50)
    track_preparation4 = TrackPreparation(track1, 90, 60)
    track_preparation5 = TrackPreparation(track1, 90, 50)

    assert track_preparation1 != track_preparation2
    assert track_preparation1 != track_preparation3
    assert track_preparation1 != track_preparation4
    assert track_preparation1 == track_preparation5
Exemplo n.º 4
0
def test_eq():
    init()

    stadium1 = Stadium("Motoarena", poland, apator, 20000, 99)
    stadium2 = Stadium("Motoarena2", poland, apator, 20000, 99)

    track1 = Track(stadium1, 300, 30, 45)
    track2 = Track(stadium1, 300, 40, 45)
    track3 = Track(stadium1, 300, 30, 50)
    track4 = Track(stadium2, 300, 30, 45)
    track5 = Track(stadium1, 400, 30, 45)
    track6 = Track(stadium1, 300, 30, 45)
    # note - equals only stadium and length
    assert track1 == track2
    assert track1 == track3
    assert track1 != track4
    assert track1 != track5
    assert track1 == track6
Exemplo n.º 5
0
def init():
    global track
    poland = Country("Poland", 38000000, 30, 60)
    league = League(poland, "polish league", None)

    ekstraliga = LeagueClass(league, "Polska Ekstraliga", 99, None, None)

    torun = City("Toruń", None, 200000, 30, 85)

    apator = Team(league, ekstraliga, "Apator", torun, poland, 99, None)

    stadium = Stadium("Motoarena", poland, apator, 20000, 99)
    track = Track(stadium, 300, 30, 45)
Exemplo n.º 6
0
def init():
    global poland
    global league
    global ekstraliga
    global torun
    global apator
    global stadium
    global track
    global track_preparation
    poland = Country("Poland", 38000000, 30, 60)
    league = League(poland, "polish league", None)

    ekstraliga = LeagueClass(league, "Polska Ekstraliga", 99, None, None)

    torun = City("Toruń", None, 200000, 30, 85)

    apator = Team(league, ekstraliga, "Apator", torun, poland, 99, None)

    stadium = Stadium("Motoarena", poland, apator, 20000, 99)
    track = Track(stadium, 300, 30, 45)
    track_preparation = TrackPreparation(track, 90, 50)
Exemplo n.º 7
0
def init_db():
    global rider
    global rider2
    global person
    global person2
    global poland
    global league
    global ekstraliga
    global druga_liga
    global pierwsza_liga
    global torun
    global bydgoszcz
    global polonia
    global apator
    global stadium_polonia
    global stadium_apator
    global track_apator
    global track_polonia
    global game_database
    global game_state
    global game_save

    rider = Rider(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    rider2 = Rider(9, 10, 11, 12, 13, 14, 15, 16, 17, 18)

    date = Date(18, 3, 1985)
    person = Person("x", "y", rider, date, 1, 2, 3, 4, 5, 6, 7, 8, 9)
    person2 = Person("x", "y", rider2, date, 9, 10, 11, 12, 13, 14, 15, 16, 17)

    poland = Country("Poland", 38000000, 30, 60)
    league = League(poland, "polish league", None)
    ekstraliga = LeagueClass(league, "Polska Ekstraliga", 99, None, None)
    druga_liga = LeagueClass(league, "Polska 2 liga", 50, None, None)
    pierwsza_liga = LeagueClass(league, "Polska 1 liga", 70, ekstraliga,
                                druga_liga)

    ekstraliga.previous_class = pierwsza_liga
    druga_liga.next_class = pierwsza_liga

    torun = City("Toruń", poland, 200000, 30, 85)
    bydgoszcz = City("Bydgoszcz", poland, 400000, 40, 55)

    polonia = Team(league, druga_liga, "Polonia", bydgoszcz, poland, 50, None)

    apator = Team(league, ekstraliga, "Apator", torun, poland, 99, [
        polonia,
    ])
    polonia.derby_teams = [
        apator,
    ]

    stadium_apator = Stadium("Motoarena", poland, apator, 20000, 99)
    stadium_polonia = Stadium("Stadion na ul. Sportowej", poland, polonia,
                              20000, 99)

    track_apator = Track(stadium_apator, 300, 30, 45)
    track_polonia = Track(stadium_polonia, 300, 30, 45)

    game_database = GameDatabase([torun, bydgoszcz], [
        poland,
    ], [
        league,
    ], [ekstraliga, pierwsza_liga, druga_liga], [person, person2],
                                 [rider, rider2],
                                 [stadium_polonia, stadium_apator],
                                 [apator, polonia],
                                 [track_polonia, track_apator])
    date = Date(1, 1, 2018)
    game_state = GameState(date)
    game_save = GameSave([torun, bydgoszcz], [
        poland,
    ], [
        league,
    ], [ekstraliga, pierwsza_liga, druga_liga], [person, person2],
                         [rider, rider2], [stadium_polonia, stadium_apator],
                         [apator, polonia], [track_polonia, track_apator],
                         game_state)