chore: fix mypy warnings in tests/cs/models
What does this merge request do and why?
This MR fixes all mypy warnings on tests/code_suggestions/models/ folder.
❯ poetry run mypy tests/code_suggestions/models/
tests/code_suggestions/models/test_palm.py:224: error: "Callable[[PalmCodeGenBaseModel], ModelMetadata]" has no attribute "name" [attr-defined]
tests/code_suggestions/models/test_palm.py:226: error: "Callable[[PalmCodeGenBaseModel], ModelMetadata]" has no attribute "name" [attr-defined]
tests/code_suggestions/models/test_palm.py:227: error: "Callable[[PalmCodeGenBaseModel], ModelMetadata]" has no attribute "engine" [attr-defined]
tests/code_suggestions/models/test_palm.py:358: error: Argument 1 to "append" of "MutableSequence" has incompatible type "dict[Any, Any]"; expected "Value" [arg-type]
tests/code_suggestions/models/test_palm.py:364: error: Value of type "TextGenModelOutput | list[TextGenModelOutput] | None" is not indexable [index]
tests/code_suggestions/models/test_palm.py:364: error: Item "str" of "str | TextGenModelOutput | Any" has no attribute "safety_attributes" [union-attr]
tests/code_suggestions/models/test_mock.py:76: error: Argument 1 to "generate" of "ChatModel" has incompatible type "list[ai_gateway.models.base_chat.Message]"; expected "list[anthropic.types.message.Message]" [arg-type]
tests/code_suggestions/models/test_mock.py:79: error: List comprehension has incompatible type List[dict[str, Any]]; expected List[Message] [misc]
tests/code_suggestions/models/test_mock.py:91: error: Argument 1 to "generate" of "ChatModel" has incompatible type "list[ai_gateway.models.base_chat.Message]"; expected "list[anthropic.types.message.Message]" [arg-type]
tests/code_suggestions/models/test_mock.py:96: error: List comprehension has incompatible type List[dict[str, Any]]; expected List[Message] [misc]
Found 10 errors in 2 files (checked 5 source files)
How to set up and validate locally
- Check out to this merge request's branch.
- Ensure the following commands do not result in any warnings (they are already run as part of CI).
make check-mypy make test
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Contributes to #715 (closed)
Edited by Tan Le