-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the "Argument must be a mapping" error message #12222
Improve the "Argument must be a mapping" error message #12222
Conversation
This comment has been minimized.
This comment has been minimized.
Could you add a test case where this makes a difference? I'd grep for existing test cases that use this message, and add another one that would be different without this PR. |
Hi @JelleZijlstra, I'm completely new to this, so I'm a little perplexed right now.
But running the
Please guide how to solve this, Thanks |
You may have to turn on strict optional mode in the test case (put |
Thanks @JelleZijlstra, this time I got some error : ) Below is the error, what I got before this PR
Output:
After this PR, below is the output so I have to replace
Shoul I replace the message with
|
and one more question, should I remove |
Hello, I'm waiting for your response; could you please direct me in the right direction? |
Hi, that's a lot of questions. For I'm not sure why you are suggesting a message with And no, the |
Thanks @JelleZijlstra
I am pushing the changes please have a look. |
test-data/unit/check-kwargs.test
Outdated
@@ -350,12 +350,15 @@ class A: pass | |||
[builtins fixtures/dict.pyi] | |||
|
|||
[case testInvalidTypeForKeywordVarArg] | |||
from typing import Dict | |||
# flags: --strict-optional | |||
from typing import Dict, Any, Optional | |||
def f(**kwargs: 'A') -> None: pass | |||
d = None # type: Dict[A, A] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d = None # type: Dict[A, A] | |
d = {} # type: Dict[A, A] |
Does this work?
Yes now it's passing all the tests, Thanks : ) |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Thanks for your contribution! |
Description
Fixes #12070
Improved the error message "error: Argument after ** must be a mapping" when there is a mismatch types