def test_stats(self): t1_skill = 10 t2_skill = 0 team1 = Team("T1", t1_skill, True, "1") team2 = Team("T2", t2_skill, True, "2") record1 = Record(1, team1, 1, 0, 0, 0, 0, 0, 0, "3") record2 = Record(1, team2, 1, 0, 0, 0, 0, 0, 0, "3") rules = GameRules("Rules", True, "4") for i in range(1000): game = Game(1, 1, team1, team2, 0, 0, False, False, rules, str(i)) game.play() record1.process_game(game.home_score, game.away_score) record2.process_game(game.away_score, game.home_score) print() print("Results") print(RecordView.get_table_header()) print( RecordView.get_table_row( RecordService.get_view_from_model(record1))) print( RecordView.get_table_row( RecordService.get_view_from_model(record2)))
def test_does_team_play_in_games_list(self): team1 = Team("Team 1", 5, False) team2 = Team("Team 2", 5, False) team3 = Team("Team 3", 5, False) team4 = Team("Team 4", 5, False) game1 = Game(1, 1, team1, team2, 0, 0, False, False, None) game2 = Game(1, 1, team3, team4, 0, 0, False, False, None) game_list_1 = [game1, game2] game_list_2 = [game2] self.assertTrue( Scheduler.does_team_play_in_games_list(game_list_1, team1)) self.assertTrue( Scheduler.does_team_play_in_games_list(game_list_1, team2)) self.assertTrue( Scheduler.does_team_play_in_games_list(game_list_1, team3)) self.assertTrue( Scheduler.does_team_play_in_games_list(game_list_1, team4)) self.assertFalse( Scheduler.does_team_play_in_games_list(game_list_2, team1)) self.assertFalse( Scheduler.does_team_play_in_games_list(game_list_2, team2)) self.assertTrue( Scheduler.does_team_play_in_games_list(game_list_2, team3)) self.assertTrue( Scheduler.does_team_play_in_games_list(game_list_2, team4))
def get_add_record(self): return CompetitionGameDTO( CompetitionGame(Competition("test", 1, None, None, 1, False, False, False, False), None, 5, CompetitionTeam(None, Team("Team 1", 5, True)), CompetitionTeam(None, Team("Team 2", 5, True)), 5, 4, True, False, None))
def test_play(self): game = Game(5, 25, Team("T1", 5, True, "1"), Team("T1", 4, True, "2"), 0, 0, False, False, GameRules("Rules", True, ""), "") np.random.seed = 1235 game.play() self.assertTrue(game.complete)
def test_does_team_play_in_game(self): team1 = Team("Team 1", 5, True) team2 = Team("Team 2", 5, True) team3 = Team("Team 3", 5, True) game = Game(1, 1, team2, team3, 0, 0, False, False, None) self.assertTrue(Scheduler.does_team_play_in_game(game, team2)) self.assertTrue(Scheduler.does_team_play_in_game(game, team3)) self.assertFalse(Scheduler.does_team_play_in_game(game, team1))
def get_updated_record(self, original_record): original_record.day = 10 original_record.year = 20 original_record.home_team = TeamDTO(Team("New Home TEam", 249, False)) original_record.away_team = TeamDTO(Team("New Away TEam", 244, True)) original_record.home_score = 30 original_record.away_score = 30 original_record.complete = True original_record.processed = False original_record.rules = GameRulesDTO(GameRules("Rules Name 2", False)) return original_record
def get_updated_record(self, original_record): original_record.day = 10 original_record.year = 20 original_record.home_team = TeamDTO(Team("New Home TEam", 249, False)) original_record.away_team = TeamDTO(Team("New Away TEam", 244, True)) original_record.home_score = 30 original_record.away_score = 30 original_record.complete = True original_record.processed = False original_record.rules = GameRulesDTO(GameRules("Rules Name 2", False)) original_record.competition = CompetitionDTO(Competition("Test 2", 5, None, None, 1, False, True, True, False)) original_record.sub_competition = TableSubCompetitionDTO(TableSubCompetition("Sub Comp", None, original_record.competition, None, 1, True, True, False, False)) return original_record
def test_add_no_existing_teams(self): session = self.setup_basic_test() name_1 = "Team GA1" name_2 = "Team GA2" team_1 = Team(name_1, 12, True, self.get_id()) team_2 = Team(name_2, 12, True, self.get_id()) self.get_repo().add(Game(1, 15, team_1, team_2, 5, 4, True, False, GameRules("Rules", True, self.get_id()), self.get_id()), session) session.commit() g_list = self.get_repo().get_all(session) self.assertEqual(1, len(g_list))
def test_should_add_team_multiple_parents(self): competition = create_default_competition_for_testing("My Comp", 3) sub_comp = TableSubCompetition("My Sub Comp", None, competition, [], 1, False, False, False, False) competition.sub_competitions.append(sub_comp) parent_comp_group_config = CompetitionGroupConfiguration( "Parent Group 1", sub_comp, None, 1, CompetitionGroupConfiguration.RANKING_TYPE, 1, None) comp_group_config = CompetitionGroupConfiguration( "Team Group 1", sub_comp, parent_comp_group_config, 1, CompetitionGroupConfiguration.RANKING_TYPE, 1, None) comp_group = CompetitionConfigurator.create_competition_group( comp_group_config, competition) self.assertEqual(2, len(competition.get_all_groups())) team = Team("My Team", 5, True) competition_team_configuration = CompetitionTeamConfiguration( team, None, comp_group_config, 1, None) comp_team = CompetitionTeam(competition, team) competition.teams = [comp_team] CompetitionConfigurator.process_competition_team_configuration( competition_team_configuration, competition) self.assertEqual(1, len(competition.teams)) self.assertEqual(1, len(comp_group.rankings)) self.assertEqual(1, len(comp_group.parent_group.rankings)) self.assertEqual(comp_team.oid, comp_group.rankings[0].team.oid) self.assertEqual(comp_team.oid, comp_group.parent_group.rankings[0].team.oid)
def create(self, name, skill, active, session=None): commit = session is None session = self.get_session(session) dto = Team(name, skill, active, self.get_new_id()) self.get_repo().add(dto, session) self.commit(session, commit)
def test_sort_records_default(self): r1 = Record(-1, Team("Team 1", 5, False), 255, 10, 0, 0, 0, 0, 0, "") r2 = Record(-1, Team("Team 2", 5, False), 255, 9, 0, 2, 0, 0, 0, "") r3 = Record(-1, Team("Team 3", 5, False), 255, 6, 2, 2, 0, 0, 0, "") r4 = Record(-1, Team("Team 4", 5, False), 255, 7, 3, 0, 0, 0, 0, "") r5 = Record(-1, Team("Team 5", 5, False), 255, 0, 0, 4, 12, 12, 0, "") r6 = Record(-1, Team("Team 6", 5, False), 255, 0, 0, 4, 6, 12, 0, "") r7 = Record(-1, Team("Team 7", 5, False), 255, 0, 0, 4, 12, 6, 0, "") records = [r7, r5, r6, r1, r2, r4, r3] Record.sort_records_default(records) self.assertEqual(1, records[0].rank) self.assertEqual(2, records[1].rank) self.assertEqual(3, records[2].rank) self.assertEqual(4, records[3].rank) self.assertEqual(5, records[4].rank) self.assertEqual(6, records[5].rank) self.assertEqual(7, records[6].rank) self.assertEqual("Team 1", records[0].team.name) self.assertEqual("Team 2", records[1].team.name) self.assertEqual("Team 4", records[2].team.name) self.assertEqual("Team 3", records[3].team.name) self.assertEqual("Team 7", records[4].team.name) self.assertEqual("Team 5", records[5].team.name) self.assertEqual("Team 6", records[6].team.name)
def setup_record_query_data(self, session): team_list = [] for i in range(10): new_id = IDHelper.get_new_id() team_list.append(Team("GBYN " + str(i), i, True, new_id)) [self.get_team_repo().add(t, session) for t in team_list] # need them to be DTOs! team_list = self.get_team_repo().get_all(session) record_year_30 = [ self.get_repo().add( Record(1, team_list[0], 30, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(2, team_list[1], 30, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(3, team_list[2], 30, 0, 0, 0, 0, 0, 0, self.get_id()), session), ] record_year_31 = [ self.get_repo().add( Record(1, team_list[2], 31, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(1, team_list[4], 31, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(1, team_list[6], 31, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(1, team_list[8], 31, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(1, team_list[9], 31, 0, 0, 0, 0, 0, 0, self.get_id()), session), ] record_year_32 = [ self.get_repo().add( Record(1, team_list[5], 32, 0, 0, 0, 0, 0, 0, self.get_id()), session), self.get_repo().add( Record(1, team_list[3], 32, 0, 0, 0, 0, 0, 0, self.get_id()), session), ] record_year_33 = [ self.get_repo().add( Record(1, team_list[1], 33, 0, 0, 0, 0, 0, 0, self.get_id()), session), ] session.commit()
def test_get_my_complete_and_unprocessed(self): session = self.setup_basic_test() Database.clean_up_database(session) team_repo = TeamRepository() rules_repo = GameRulesRepository() team1 = Team("t1", 5, True, "A") team2 = Team("t2", 5, True, "B") team_repo.add(team1, session) team_repo.add(team2, session) gr = GameRules("Rules 12", True, "T") rules_repo.add(gr, session) session.commit() team1 = team_repo.get_by_name("t1", session) team2 = team_repo.get_by_name("t2", session) gr = rules_repo.get_by_name("Rules 12", session) game1 = Game(1, 1, team1, team2, 0, 0, True, False, gr, "1") game2 = Game(1, 1, team1, team2, 0, 0, False, False, gr, "2") game3 = Game(1, 2, team1, team2, 0, 0, False, False, gr, "3") game4 = Game(1, 2, team1, team2, 0, 0, False, False, gr, "4") game5 = Game(1, 3, team1, team2, 0, 0, True, False, gr, "5") game6 = Game(1, 3, team1, team2, 0, 0, False, False, gr, "6") game7 = Game(1, 4, team1, team2, 0, 0, True, False, gr, "7") game8 = Game(2, 1, team1, team2, 0, 0, True, False, gr, "8") games = [game1, game2, game3, game4, game5, game6, game7, game8] [self.get_repo().add(g, session) for g in games] session.commit() result = list(self.get_repo().get_by_unprocessed_and_complete(1, 1, 4, session)) self.assertEqual(3, len(result)) result = list(self.get_repo().get_by_unprocessed_and_complete(1, 1, 2, session)) self.assertEqual(1, len(result)) result = list(self.get_repo().get_by_unprocessed_and_complete(2, 1, 25, session)) self.assertEqual(1, len(result))
def test_get_first_day_for_game(self): session = self.setup_basic_test() Database.clean_up_database(session) team_repo = TeamRepository() rules_repo = GameRulesRepository() team1 = Team("t1", 5, True, "A") team2 = Team("t2", 5, True, "B") team3 = Team("t3", 5, True, "C") team4 = Team("t4", 5, True, "D") new_teams = [team1, team2, team3, team4] [team_repo.add(team, session) for team in new_teams] new_gr = GameRules("Rules 12", True, "T") rules_repo.add(new_gr, session) session.commit() gr = rules_repo.get_by_name("Rules 12", session) teams = team_repo.get_all(session) game1 = Game(1, 5, teams[0], teams[1], 0, 1, True, True, gr, "K") games = [game1] [self.get_repo().add(game, session) for game in games] session.commit() # first test, should be none because teams[0] plays on day 5 game2 = GameDTO(Game(1, -1, teams[0], teams[2], 0, 1, True, True, gr, "L")) result = self.get_repo().get_list_days_teams_play_on(1, 1, 100, game2, session) self.assertEquals(5, result[0]) game2.day = 1 self.get_repo().add(game2, session) session.commit() result = self.get_repo().get_list_days_teams_play_on(1, 1, 100, game2, session) print(result)
def get_updated_record(self, original_record): original_record.rank = 3 original_record.year = 15 original_record.wins = 1 original_record.loses = 2 original_record.ties = 3 original_record.goals_for = 4 original_record.goals_against = 5 original_record.skill = 20 original_record.team = TeamDTO(Team("New Team Name", 12, False)) return original_record
def setup_default_series(games): home_team = Team("Team 1", 5, True) away_team = Team("Team 2", 5, True) competition = create_default_competition_for_testing("My Comp") sub_competition = PlayoffSubCompetition("My Playoff", None, competition, None, 1, 1, True, False, False, False) home_competition_team = CompetitionTeam(competition, home_team) away_competition_team = CompetitionTeam(competition, away_team) game_rules = GameRules("My Rules", False) series_rules = SeriesByWinsRules("My Rules", games, game_rules, None) series = SeriesByWins(sub_competition, "My Series", 1, home_competition_team, away_competition_team, 0, 0, series_rules, None, None, None, None, None, None, None, None, True, False) return series
def test_add_new_team(self): session = self.setup_basic_test() team_id = IDHelper.get_new_id() team = Team("Record Add For New Team", 5, True, team_id) record = Record(1, team, 1, 2, 3, 4, 5, 6, 7, IDHelper.get_new_id()) self.get_repo().add(record, session) session.commit() result = self.get_repo().get_by_oid(record.oid, session) self.assertEqual(result.oid, record.oid) self.assertEqual(result.team.oid, record.team.oid)
def test_should_fail_group_not_created(self): with pytest.raises( DomainError, match="Group Team Group 1 has not been created yet."): competition = create_default_competition_for_testing("My Comp") sub_comp_config = SubCompetitionConfiguration( "Test", None, None, None, None, None, None, None, None) comp_group_config = CompetitionGroupConfiguration( "Team Group 1", sub_comp_config, None, 1, CompetitionGroupConfiguration.RANKING_TYPE, 1, None) team = Team("My Team", 5, True) competition_team_configuration = CompetitionTeamConfiguration( team, None, comp_group_config, 1, None) CompetitionConfigurator.process_competition_team_configuration( competition_team_configuration, competition)
def should_get_by_status(self): session = self.setup_basic_test() for i in range(5): oid = IDHelper.get_new_id() active = True if i % 2 == 0: active = False self.get_repo().add( TeamDTO(Team("team " + str(i) + " add_all", i, True, oid)), session) session.commit() result = self.get_repo().get_by_active_status(True) self.assertEqual(2, len(result)) result = self.get_repo().get_by_active_status(True) self.assertEqual(3, len(result))
def test_does_any_team_play_in_other_list(self): team1 = Team("Team 1", 5, False) team2 = Team("Team 2", 5, False) team3 = Team("Team 3", 5, False) team4 = Team("Team 4", 5, False) team5 = Team("Team 5", 5, False) team6 = Team("Team 6", 5, False) team7 = Team("Team 6", 5, False) team8 = Team("Team 6", 5, False) game1 = Game(1, 1, team1, team2, 0, 0, False, False, None) game2 = Game(1, 1, team3, team4, 0, 0, False, False, None) game3 = Game(1, 1, team5, team6, 0, 0, False, False, None) game4 = Game(1, 1, team1, team3, 0, 0, False, False, None) game5 = Game(1, 1, team2, team5, 0, 0, False, False, None) game6 = Game(1, 1, team4, team6, 0, 0, False, False, None) game7 = Game(1, 1, team7, team8, 0, 0, False, False, None) game_list_1 = [game1, game2, game3] game_list_2 = [game2, game3, game4] game_list_3 = [game1, game2] game_list_4 = [game6] game_list_5 = [game1, game2] game_list_6 = [game3, game7] # all teams play in all other games self.assertTrue( Scheduler.does_any_team_play_in_other_list(game_list_1, game_list_2)) # only one home team plays in other day self.assertTrue( Scheduler.does_any_team_play_in_other_list(game_list_4, game_list_3)) # no teams play self.assertFalse( Scheduler.does_any_team_play_in_other_list(game_list_5, game_list_6))
def test_get_all(self): session = self.setup_basic_test() team_names = ["Team A1", "Team A2", "Team A5"] [ self.get_team_repo().add(Team(t, 0, True, IDHelper.get_new_id()), session) for t in team_names ] session.commit() [ self.get_repo().add( Record(1, team, 1, 2, 3, 4, 5, 6, 7, IDHelper.get_new_id()), session) for team in self.get_team_repo().get_all(session) ] session.commit() self.assertEqual(3, len(self.get_repo().get_all(session)))
def test_should_fail_too_many_groups(self): with pytest.raises(DomainError, match="Group Team Group 1 has multiple groups 2."): competition = create_default_competition_for_testing("My Comp") sub_comp = TableSubCompetition("My Sub Comp", None, competition, [], 1, False, False, False, False) competition.sub_competitions.append(sub_comp) comp_group_config = CompetitionGroupConfiguration( "Team Group 1", sub_comp, None, 1, CompetitionGroupConfiguration.RANKING_TYPE, 1, None) comp_group = CompetitionConfigurator.create_competition_group( comp_group_config, competition) sub_comp.groups.append(comp_group) team = Team("My Team", 5, True) competition_team_configuration = CompetitionTeamConfiguration( team, None, comp_group_config, 1, None) CompetitionConfigurator.process_competition_team_configuration( competition_team_configuration, competition)
def test_should_add_team_team_does_not_exist(self): competition = create_default_competition_for_testing("My Comp") sub_comp = TableSubCompetition("My Sub Comp", [], competition, [], 1, False, False, False, False) competition.sub_competitions.append(sub_comp) comp_group_config = CompetitionGroupConfiguration( "Team Group 1", sub_comp, None, 1, CompetitionGroupConfiguration.RANKING_TYPE, 1, None) comp_group = CompetitionConfigurator.create_competition_group( comp_group_config, competition) team = Team("My Team", 5, True) competition_team_configuration = CompetitionTeamConfiguration( team, sub_comp, comp_group_config, 1, None) CompetitionConfigurator.process_competition_team_configuration( competition_team_configuration, competition) self.assertEqual(1, len(competition.teams)) self.assertEqual(1, len(comp_group.rankings)) self.assertEqual(team.oid, comp_group.rankings[0].team.parent_team.oid)
from teams.domain.team import Team toronto = Team("Toronto", 5, True) montreal = Team("Montreal", 5, True) ottawa = Team("Ottawa", 5, True) quebec_city = Team("Quebec City", 5, True) calgary = Team("Calgary", 5, True) edmonton = Team("Edmonton", 5, True) vancouver = Team("Vancouver", 5, True) winnipeg = Team("Winnipeg", 5, True) victoria = Team("Victoria", 5, True) saskatoon = Team("Saskatoon", 5, True) hamilton = Team("Hamilton", 5, True) halifax = Team("Halifax", 5, True) boston = Team("Boston", 5, True) new_york = Team("New York", 5, True) detroit = Team("Detroit", 5, True) chicago = Team("Chicago", 5, True) seattle = Team("Seattle", 5, True) minnesota = Team("Minnesota", 5, True) colorado = Team("Colorado", 5, True) san_jose = Team("San Jose", 5, True) los_angelas = Team("Los Angelas", 5, True) pittsburgh = Team("Pittsburgh", 5, True) teams = [ toronto, montreal, ottawa, quebec_city, calgary, edmonton, vancouver, winnipeg, victoria, saskatoon, hamilton, halifax, boston, new_york, detroit, chicago, seattle, minnesota, colorado, san_jose, los_angelas, pittsburgh ]
def get_add_record(self): return GameDTO(Game(1, 2, TeamDTO(Team("Home team", 250, True)), TeamDTO(Team("Away Team", 251, False)), 3, 4, False, True, GameRulesDTO(GameRules("Rules Name", False))))
def setup_config(rand, canadian_league_name, american_league_name, playoff_name, season_game_rules, playoff_game_rules): min_skill = 0 max_skill = 10 toronto = Team("Toronto", rand.randint(min_skill, max_skill), True) montreal = Team("Montreal", rand.randint(min_skill, max_skill), True) ottawa = Team("Ottawa", rand.randint(min_skill, max_skill), True) quebec_city = Team("Quebec City", rand.randint(min_skill, max_skill), True) vancouver = Team("Vancouver", rand.randint(min_skill, max_skill), True) calgary = Team("Calgary", rand.randint(min_skill, max_skill), True) edmonton = Team("Edmonton", rand.randint(min_skill, max_skill), True) winnipeg = Team("Winnipeg", rand.randint(min_skill, max_skill), True) boston = Team("Boston", rand.randint(min_skill, max_skill), True) detroit = Team("Detroit", rand.randint(min_skill, max_skill), True) new_york = Team("New York", rand.randint(min_skill, max_skill), True) series_rules = SeriesByWinsRules("Best of 7", 4, playoff_game_rules, [0, 0, 1, 1, 0, 1, 0]) series_rules_2 = SeriesByWinsRules("Best of 3", 2, playoff_game_rules, [1, 0, 0]) competition_config = CompetitionConfiguration("Test", [], [], 1, 1, None) # table config canadian_table_config = TableSubCompetitionConfiguration( canadian_league_name, competition_config, [], [], 1, 1, None) american_table_config = TableSubCompetitionConfiguration( american_league_name, competition_config, [], [], 1, 1, None) competition_config.sub_competitions.append(canadian_table_config) competition_config.sub_competitions.append(american_table_config) canadian_config = RankingGroupConfiguration("Canadian", canadian_table_config, None, 1, 1, None) western_config = RankingGroupConfiguration("Western", canadian_table_config, canadian_config, 2, 1, None) eastern_config = RankingGroupConfiguration("Eastern", canadian_table_config, canadian_config, 2, 1, None) american_config = RankingGroupConfiguration("American", american_table_config, None, 1, 1, None) all_teams = [ calgary, edmonton, toronto, montreal, ottawa, vancouver, quebec_city, winnipeg, boston, detroit, new_york ] western_teams = [calgary, edmonton, vancouver, winnipeg] eastern_teams = [toronto, montreal, ottawa, quebec_city] american_teams = [boston, detroit, new_york] canadian_teams = [ calgary, edmonton, toronto, montreal, ottawa, vancouver, quebec_city, winnipeg ] team_group_map = { western_config.name: { "config": western_config, "teams": western_teams, "sub_comp": canadian_table_config }, eastern_config.name: { "config": eastern_config, "teams": eastern_teams, "sub_comp": canadian_table_config }, american_config.name: { "config": american_config, "teams": american_teams, "sub_comp": american_table_config }, canadian_config.name: { "config": canadian_config, "teams": canadian_teams, "sub_comp": canadian_table_config } } team_configs = [] for key in team_group_map.keys(): config = team_group_map[key]["config"] teams = team_group_map[key]["teams"] sub_comp = team_group_map[key]["sub_comp"] for t in teams: team_configs.append( CompetitionTeamConfiguration(t, competition_config, config, 1, None)) sub_comp.competition_groups.append(config) competition_config.teams = team_configs # playoff config playoff_config = PlayoffSubCompetitionConfiguration( playoff_name, competition_config, [], [], [], 1, 1, None) competition_config.sub_competitions.append(playoff_config) r1_winners = RankingGroupConfiguration("R1 Winners", playoff_config, None, 1, 1, None) american_rep = RankingGroupConfiguration("American Champion", playoff_config, None, 1, 1, None) champion = RankingGroupConfiguration("Champion", playoff_config, None, 1, 1, None) runner_up = RankingGroupConfiguration("Runner Up", playoff_config, None, 1, 1, None) can_am_winners = RankingGroupConfiguration("CanAm Challenge Winners", playoff_config, None, 1, 1, None) playoff_config.competition_groups = [ r1_winners, champion, runner_up, american_rep ] # round 1 r1s1 = SeriesConfiguration("R1S1", 1, playoff_config, western_config, 1, eastern_config, 2, series_rules, r1_winners, canadian_config, None, None, 1, None) r1s2 = SeriesConfiguration("R1S2", 1, playoff_config, eastern_config, 1, western_config, 2, series_rules, r1_winners, canadian_config, None, None, 1, None) r1s3 = SeriesConfiguration("AMF", 1, playoff_config, american_config, 1, american_config, 2, series_rules, american_rep, american_config, None, None, 1, None) # Final final = SeriesConfiguration("Final", 2, playoff_config, r1_winners, 1, r1_winners, 2, series_rules, champion, canadian_config, runner_up, canadian_config, 1, None) # misc can_am = SeriesConfiguration("CanAm", 3, playoff_config, canadian_config, 8, american_rep, 1, series_rules_2, can_am_winners, None, None, None, 1, None) series_config = [r1s1, r1s2, r1s3, final, can_am] playoff_config.series = series_config # configuration done return competition_config
import random from teams.domain.competition import Competition, CompetitionTeam from teams.domain.game import GameRules from teams.domain.series import SeriesByGoals from teams.domain.series_rules import SeriesByGoalsRules from teams.domain.sub_competition import PlayoffSubCompetition from teams.domain.team import Team home_team = Team("Team 1", 5, True) away_team = Team("Team 2", 5, True) competition = Competition("My Comp", 1, None, None, True, True, False, False) sub_competition = PlayoffSubCompetition("Playoff A", None, competition, 1, 1, True, True, False, False) home_competition_team = CompetitionTeam(competition, home_team) away_competition_team = CompetitionTeam(competition, away_team) game_rules = GameRules("Playoff", True) last_game_rules = GameRules("Last Game", False) series_rules = SeriesByGoalsRules("My Rules", 2, game_rules, last_game_rules, None) series = SeriesByGoals(sub_competition, "My Series", 1, home_competition_team, away_competition_team, 0, 0, 0, series_rules, None, None, None, None, None, None, None, None, True, False) games = []
def new_team(name, skill): return Team(name, skill, True)
def get_add_record(self): return RecordDTO( Record(5, TeamDTO(Team("Team Name", 5, True)), 25, 10, 20, 30, 40, 50, 200))
def create_object(self, **kwargs): return CompetitionTeamDTO( CompetitionTeam( None, Team(kwargs["name"], kwargs["skill"], kwargs["active"]), kwargs["id"]))