Example #1
0
def init():
    global poland
    global league
    global ekstraliga
    global druga_liga
    global torun
    global bydgoszcz
    global polonia
    global apator

    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)

    torun = City("Toruń", None, 200000, 30, 85)
    bydgoszcz = City("Bydgoszcz", None, 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,
    ]
Example #2
0
def test_eq():
    poland = Country("Poland", 38000000, 30, 60)
    league = League(poland, "polish league", None)

    class1 = LeagueClass(league, "Polska Ekstraliga", 99, None, None)
    class2 = LeagueClass(league, "Polska 1 liga", 70, class1, None)
    class3 = LeagueClass(league, "Polska Ekstraliga", 89, class2, None)

    assert class1 != class2
    assert class1 == class3  # it is not a bug, it's a feature - compare only names.
    assert class2 != class3
Example #3
0
def test_ability():
    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)
    league.classes = [ekstraliga, pierwsza_liga, druga_liga]
    assert league.ability == 73

    ekstraliga.ability = 3
    pierwsza_liga.ability = 4
    druga_liga.ability = 5

    assert league.ability == 4
Example #4
0
def test_constructor():
    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

    assert ekstraliga.league == league
    assert pierwsza_liga.league == league
    assert druga_liga.league == league

    assert ekstraliga.name == "Polska Ekstraliga"
    assert pierwsza_liga.name == "Polska 1 liga"
    assert druga_liga.name == "Polska 2 liga"

    assert ekstraliga.ability == 99
    assert pierwsza_liga.ability == 70
    assert druga_liga.ability == 50

    assert not ekstraliga.next_class
    assert ekstraliga.previous_class == pierwsza_liga

    assert pierwsza_liga.next_class == ekstraliga
    assert pierwsza_liga.previous_class == druga_liga

    assert druga_liga.next_class == pierwsza_liga
    assert not druga_liga.previous_class
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)
Example #6
0
def init():
    global poland
    global league
    global ekstraliga
    global torun
    global apator
    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)
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)
Example #8
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)