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, ]
def test_eq(): city1 = City("Toruń", None, 100000, 30, 85) city2 = City("Bydgoszcz", None, 100000, 30, 85) city3 = City("Toruń", None, 10000, 3, 8) assert city1 == city3 # not a bug, a feature - equals only city name assert city1 != city2 assert city2 != city3
def test_constructor(): city = City("Toruń", None, 100000, 30, 85) assert city.name == "Toruń" assert not city.country assert city.population == 100000 assert city.wealth == 30 assert city.speedway_popularity == 85
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)
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)
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)