refactor(api): remove safe type ignores from MCP tests#36193
Open
Dawn-Fighter wants to merge 2 commits into
Open
refactor(api): remove safe type ignores from MCP tests#36193Dawn-Fighter wants to merge 2 commits into
Dawn-Fighter wants to merge 2 commits into
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-15 03:39:22.429943386 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-15 03:39:15.395900671 +0000
@@ -4104,14 +4104,6 @@
--> tests/unit_tests/core/mcp/session/test_client_session.py:557:12
ERROR Object of class `ListRootsResult` has no attribute `message` [missing-attribute]
--> tests/unit_tests/core/mcp/session/test_client_session.py:558:31
-ERROR Object of class `NoneType` has no attribute `idempotentHint` [missing-attribute]
- --> tests/unit_tests/core/mcp/test_types.py:254:16
-ERROR `in` is not supported between `Literal['authorization_code']` and `None` [not-iterable]
- --> tests/unit_tests/core/mcp/test_types.py:335:16
-ERROR `in` is not supported between `Literal['S256']` and `None` [not-iterable]
- --> tests/unit_tests/core/mcp/test_types.py:380:16
-ERROR Argument `Literal['1.0']` is not assignable to parameter `jsonrpc` with type `Literal['2.0']` in function `core.mcp.types.JSONRPCRequest.__init__` [bad-argument-type]
- --> tests/unit_tests/core/mcp/test_types.py:458:25
ERROR Argument `_FakeModelRuntime` is not assignable to parameter `runtime` with type `ModelRuntime` in function `core.plugin.impl.model_runtime_factory.create_model_type_instance` [bad-argument-type]
--> tests/unit_tests/core/model_runtime/test_model_provider_factory.py:401:17
ERROR Argument `_FakeModelRuntime` is not assignable to parameter `runtime` with type `ModelRuntime` in function `core.plugin.impl.model_runtime_factory.create_model_type_instance` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
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
# type: ignorecomments from MCP type tests by using typed capability models and explicit narrowing.model_extra.Related Issue
Verification
uv run --project api --with ruff ruff check api/tests/unit_tests/core/mcp/test_types.pyuv run --project api pytest -o addopts='' api/tests/unit_tests/core/mcp/test_types.pyuv run --project api pyright api/tests/unit_tests/core/mcp/test_types.py