Skip to content

Commit

Permalink
fix: test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
DesiPilla committed Dec 20, 2023
1 parent da3da43 commit bf77794
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/football/unit/test_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,31 @@ def test_standings_weekly(self, m):
# final_standings = [team.team_id for team in league.standings()]
# self.assertEqual(week13_standings, final_standings)

def get_list_of_team_data(self, league: League, week: int):
list_of_team_data = []
for team in league.teams:
team_data = {
"team": team,
"team_id": team.team_id,
"division_id": team.division_id,
"wins": sum([1 for outcome in team.outcomes[:week] if outcome == "W"]),
"ties": sum([1 for outcome in team.outcomes[:week] if outcome == "T"]),
"losses": sum(
[1 for outcome in team.outcomes[:week] if outcome == "L"]
),
"points_for": sum(team.scores[:week]),
"points_against": sum(
[team.schedule[w].scores[w] for w in range(week)]
),
"schedule": team.schedule[:week],
"outcomes": team.outcomes[:week],
}
team_data["win_pct"] = (team_data["wins"] + team_data["ties"] / 2) / sum(
[1 for outcome in team.outcomes[:week] if outcome in ["W", "T", "L"]]
)
list_of_team_data.append(team_data)
return list_of_team_data

@requests_mock.Mocker()
def test_build_h2h_dict(self, m):
self.mock_setUp(m)
Expand Down

0 comments on commit bf77794

Please sign in to comment.