Skip to content

Commit

Permalink
test: add better test method
Browse files Browse the repository at this point in the history
Now explicitly tests for the exact standings of the test league
  • Loading branch information
DesiPilla committed Dec 17, 2023
1 parent 005af2a commit e200fd3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/football/unit/test_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ def test_standings_weekly(self, m):

league = League(self.league_id, self.season)

week = 1
standings = league.standings_weekly(1)
best_team_after_week = sum(
[1 for outcome in standings[0].outcomes[:week] if outcome == "W"]
)
worst_team_after_week = sum(
[1 for outcome in standings[-1].outcomes[:week] if outcome == "W"]
)
self.assertEqual(best_team_after_week >= worst_team_after_week, True)
# Test various weeks
week1_standings = [team.team_id for team in league.standings_weekly(1)]
self.assertEqual(week1_standings, [3, 11, 2, 10, 7, 8, 4, 5, 9, 1])

week4_standings = [team.team_id for team in league.standings_weekly(4)]
self.assertEqual(week4_standings, [2, 7, 11, 4, 3, 9, 1, 8, 5, 10])

# # Does not work with the playoffs
# week13_standings = [team.team_id for team in league.standings_weekly(13)]
# final_standings = [team.team_id for team in league.standings()]
# self.assertEqual(week13_standings, final_standings)

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

0 comments on commit e200fd3

Please sign in to comment.