Fix undefined forward-ref type annotations and remove dead duplicate tests#258
Open
serrebidev wants to merge 1 commit into
Open
Fix undefined forward-ref type annotations and remove dead duplicate tests#258serrebidev wants to merge 1 commit into
serrebidev wants to merge 1 commit into
Conversation
…tests Resolve all 14 ruff F821 undefined-name errors in the server tree. Three were genuine wrong class names in string annotations (AuthUserRecord -> UserRecord, GuidedTableRuleState -> GuidedTableState, ChaosPlayer -> ChaosBearPlayer); the rest were correct names missing their type-only imports (Table, TribeState, GnubgProcess, SorryPawnState). Also remove three dead duplicate definitions that were silently shadowed and never executed: two redefined test functions in test_virtual_bots.py and a doubled save_state method in a test fake. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Pre-existing lint cleanup in the server tree (none of these were introduced by an open PR; the repo's gated ruff set E9/F63/F7 stays clean, but a broader scan surfaced these).
Resolves all 14 ruff
F821undefined-name errors:NameErrorundertyping.get_type_hints():AuthUserRecord→UserRecord(core/server.py)GuidedTableRuleState→GuidedTableState(core/virtual_bots.py, ×3)ChaosPlayer→ChaosBearPlayer(games/chaosbear/game.py)Table,TribeState,GnubgProcess,SorryPawnState.Removes three dead duplicate definitions that Python silently shadowed, so they never executed:
test_process_leaving_game_logout_branchandtest_process_leaving_game_offline_path(redefined later intest_virtual_bots.py)save_statemethod in a test fake (test_server_admin_virtual_bots.py)The surviving copies assert equivalent outcomes, so no coverage is lost.
Testing
uvx ruff check server --select F821→ All checks passed (was 14 errors)uv run --extra dev pytest tests/test_virtual_bots.py tests/test_server_admin_virtual_bots.py→ 91 passeduv run --extra dev pytest tests/test_ageofheroes.py tests/test_backgammon.py tests/test_chaosbear.py tests/test_sorry.py→ 145 passed🤖 Generated with Claude Code