Delete tavern gamble tests that hand-roll the payout instead of calling gamble() - #166
Merged
Merged
Conversation
…ng gamble()
test_gamble_win_shows_correct_amount and test_gamble_loss executed the
win/loss arithmetic themselves rather than calling Tavern.gamble(), so
they passed even with gamble() removed entirely. The win test also
encoded even-money payout ("You won $50!" on a $50 bet), which is
$300 short of the real 5x payout - a regression the suite could not
have caught.
test_gamble_win_pays_multiple_of_bet and test_gamble_loss_via_real_loop
already drive the real loop and cover the same branches correctly;
folded the win test's prompt-text check into the former, derived from
DICE_WIN_MULTIPLIER instead of hardcoded.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric:
Summary: all rubric items pass, CI green, fix empirically verified by reverting and re-testing. Do-not-auto-merge match: this diff deletes 78 lines from a single file (over the repo's 50-line threshold), so per Phase 8 this needs an explicit human merge decision rather than an autonomous merge. drafted by Claude on behalf of Daniel Stephenson |
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.
Summary
test_gamble_win_shows_correct_amountandtest_gamble_loss(tests/location/test_tavern.py) hand-executed the win/loss arithmetic instead of callingTavern.gamble()— both pass even withgamble()deleted entirely (confirmed by temporarily stubbing it out and rerunning).money == 150on a $50 bet) instead of the realDICE_WIN_MULTIPLIER(5x) payout of $350 — a hardcoded assertion that could never catch a regression to that old behavior.test_gamble_win_pays_multiple_of_betandtest_gamble_loss_via_real_loopalready drive the realgamble()loop and cover the same branches correctly; folded the win test's "shows the actual amount, not $0" prompt-text check intotest_gamble_win_pays_multiple_of_bet, deriving the expected figure fromDICE_WIN_MULTIPLIERinstead of hardcoding it.Test plan
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy python3 -m pytest tests/location/test_tavern.py— 30 passedSDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy python3 -m pytest— 727 passedwinAmount = self.currentBet * DICE_WIN_MULTIPLIERtowinAmount = self.currentBet(reintroducing the even-money bug) —test_gamble_win_pays_multiple_of_betfailed as expected, confirming the surviving test actually exercises the payout math. Reverted afterward.Flagging for review: this PR deletes 78 lines from a single file, over this repo's 50-line do-not-auto-merge threshold, so per the dev-loop's merge policy it needs an explicit human decision rather than an autonomous merge even though it's test-only and CI is green.
Closes #154
drafted by Claude on behalf of Daniel Stephenson