VisualizerCommandTests: type the send_command mock so assertions need no ignores#1158
Merged
BioCam merged 1 commit intoJul 8, 2026
Merged
Conversation
…ed no ignores Mypy types self.vis.send_command as the original coroutine method, so every mock assertion needed a type: ignore[attr-defined] and the newly added _wait_for_event helper broke typechecking on main. Keep the AsyncMock in a typed attribute and assert through it; only the inherent method-assign suppression on the monkeypatch line remains. Co-Authored-By: Claude Fable 5 <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.
Main's type checking job currently reds on the
_wait_for_eventhelper added in 274da63: mypy typesself.vis.send_commandas the original coroutine method, so.call_argsis an attr-defined error.Rather than adding another suppression, keep the
AsyncMockin a typed attribute (self.send_command_mock) inasyncSetUpand route all assertions through it. This removes the five per-usetype: ignore[attr-defined]comments inVisualizerCommandTests; only the inherentmethod-assignsuppression on the monkeypatch line remains.Verified locally:
make typecheckclean over all 500 files,ruff format --checkandruff check --select Ipass, all 22 visualizer tests pass.🤖 Generated with Claude Code