Skip to content

Commit 7fd482e

Browse files
committed
Add input validation to team_fielding_bref (#462)
- Add team.upper() to handle case-insensitive team abbreviations - Add end_season < start_season validation with clear error message
1 parent e588989 commit 7fd482e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pybaseball/team_fielding.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def team_fielding_bref(team: str, start_season: int, end_season: Optional[int]=N
3232
)
3333
if end_season is None:
3434
end_season = start_season
35+
if end_season < start_season:
36+
raise ValueError(
37+
"end_season must be greater than or equal to start_season."
38+
)
3539

40+
team = team.upper()
3641
url = "https://www.baseball-reference.com/teams/{}".format(team)
3742

3843
raw_data = []

0 commit comments

Comments
 (0)