Skip to content

Commit

Permalink
Handle bye weeks in string representation
Browse files Browse the repository at this point in the history
If you print a matchup object where there is a bye week, it fails with an error because there is no away team.
  • Loading branch information
JasonFreeberg authored Nov 5, 2024
1 parent c41ff3d commit 16a1c5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion espn_api/football/matchup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ def __init__(self, data):
self.away_team: Team

def __repr__(self):
return f'Matchup({self.home_team}, {self.away_team})'
if hasattr(self, 'away_team'):
return f'Matchup({self.home_team}, {self.away_team})'
else:
return f'Matchup({self.home_team}, N/A)'

Check warning on line 17 in espn_api/football/matchup.py

View check run for this annotation

Codecov / codecov/patch

espn_api/football/matchup.py#L17

Added line #L17 was not covered by tests


def _fetch_matchup_info(self, data, team):
'''Fetch info for matchup'''
Expand Down

0 comments on commit 16a1c5c

Please sign in to comment.