Skip to content

Add input validation to team_fielding_bref#502

Open
yasumorishima wants to merge 1 commit intojldbc:masterfrom
yasumorishima:fix/issue-462-team-fielding-bref-validation
Open

Add input validation to team_fielding_bref#502
yasumorishima wants to merge 1 commit intojldbc:masterfrom
yasumorishima:fix/issue-462-team-fielding-bref-validation

Conversation

@yasumorishima
Copy link

Summary

  • Add team.upper() to handle case-insensitive team abbreviations (e.g., "oak""OAK")
  • Add end_season < start_season validation with a clear error message

Closes #462

Details

Previously, passing a lowercase team abbreviation like "oak" caused an AttributeError because the URL constructed with the lowercase string returned no matching HTML elements. Adding .upper() follows the same pattern used in team_results.py.

Additionally, passing end_season before start_season (e.g., team_fielding_bref("NYY", 2023, 2020)) silently returned an empty DataFrame. Now it raises a ValueError with a clear message.

- Add team.upper() to handle case-insensitive team abbreviations
- Add end_season < start_season validation with clear error message

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

team_fielding_bref() can be improved for better parameter formatting and error handling

1 participant