fix: allow gamePks schedule queries without date - #308
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Fixes #245.
Schedule requests using
gamePkswere incorrectly requiring a date. Bothget_schedule()andget_scheduled_games_by_date()would returnNonebefore the request ever reached the MLB API whengamePkswas provided without a date.The MLB schedule endpoint supports querying by
gamePkswithout requiring a date.What
gamePksschedule queries without a date inget_schedule()gamePksschedule queries without a date inget_scheduled_games_by_date()gamePksis providedgamePks-only requests for both methodsTests
Added regression tests in
tests/test_schedule_regressions.py.The tests verify that:
gamePks-only request reaches the data adaptergamePksis passed through correctlysportIdis preservedThe tests were confirmed to fail before the fix because the adapter was never called, and pass after the change.
Full test suite passes.
Risk and impact
Risk: Minimal
The change is limited to the schedule parameter validation logic and only changes behavior when
gamePksis supplied without a date. Existing date and date-range behavior is unchanged.If something does go wrong, the impact should be limited to schedule queries involving
gamePks. The added regression tests cover the affected code paths.