-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add signature for dataclasses.replace #14849
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
Changes from 1 commit
6dbaf9c
4dcbe44
7ed3741
89257b5
32b1d47
1f08816
c456a5f
8118d29
789cb2b
9f0974c
a37e406
367c0e9
0e84c4f
9cfc081
7b907cf
985db60
15dbb7b
3227fde
2dbf249
b32881c
26056a4
40315b7
c005895
d71bc21
d914b94
2cb6dee
5735726
d38897e
04f0ee3
f402b86
306c3f3
9b491f5
283fe3d
29780e9
9c43ab6
94024ba
70240c4
99bf973
8fe75a7
bea50e8
cd35951
d71a7c0
957744e
6abf6ff
4c4fc94
be4a290
ee0ae21
3f656f8
65d6e89
File filter
Filter by extension
Convers 8000 ations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[case replace] | ||
[file model.py] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this case may be not correct, there should be a top-level section like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's meaningful to import it? I would think mypy goes over all Python files, rather than follow the import chain. e.g. echo > foo.py
echo "a: str = 42" > bar.py
mypy . results in
I don't mind adding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was worried fine-grained test runner doesn't simply check all files (like some other test runners), but I checked the code, and it actually looks OK. |
||
from dataclasses import dataclass | ||
|
||
@dataclass | ||
class Model: | ||
x: int = 0 | ||
[file replace.py] | ||
from dataclasses import replace | ||
from model import Model | ||
|
||
m = Model() | ||
replace(m, x=42) | ||
|
||
[file model.py.2] | ||
from dataclasses import dataclass | ||
|
||
@dataclass | ||
class Model: | ||
x: str = 'hello' | ||
|
||
[builtins fixtures/dataclasses.pyi] | ||
[out] | ||
== | ||
replace.py:5: error: Argument "x" to "replace" of "Model" has incompatible type "int"; expected "str" |
Uh oh!
There was an error while loading. Please reload this page.