You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ mypy test.pytest.py:4: error: Argument 2 to "append" of "MultipartWriter" has incompatible type "dict[str, str]"; expected "MultiMapping[str] | None" [arg-type]Found 1 error in 1 file (checked 1 source file)
❯ pyright test.py/Users/joshua.ellis/src/pact-foundation/pact-python/tests/v3/test.py /Users/joshua.ellis/src/pact-foundation/pact-python/tests/v3/test.py:4:37 - error: Argument of type "dict[str, str]" cannot be assigned to parameter "headers" of type "MultiMapping[str] | None" in function "append" Type "dict[str, str]" cannot be assigned to type "MultiMapping[str] | None" "dict[str, str]" is incompatible with "MultiMapping[str]" Type cannot be assigned to type "None" (reportGeneralTypeIssues)1 error, 0 warnings, 0 informations
Expected behavior
I expected that a regular Python dictionary be compatible with the header argument.
Yes, it appears the argument is always passed into CIMultiDict.update(), which should accept a Mapping. Feel free to make a PR to change the annotation (I suspect you'll need to tweak a couple of other annotations too).
Describe the bug
It would appear that the
append
method of the MultiPartWriter has an incorrect type definition:aiohttp/aiohttp/multipart.py
Line 856 in d8936aa
Resulting in type checking tools to incorrectly errpr what (I believe) should be correct.
To Reproduce
The following test file generates the error in type checkers.
which generates the following errors:
Expected behavior
I expected that a regular Python dictionary be compatible with the header argument.
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Related component
Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: