Skip to content

Commit 44b2e5d

Browse files
authored
Upgrade to mypy 1.7.0 (#506)
1 parent a44b487 commit 44b2e5d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def find_stub_files(name: str) -> List[str]:
2929

3030
# Keep compatible-mypy major.minor version pinned to what we use in CI (requirements.txt)
3131
extras_require = {
32-
"compatible-mypy": ["mypy~=1.6.0", "django-stubs[compatible-mypy]"],
32+
"compatible-mypy": ["mypy~=1.7.0", "django-stubs[compatible-mypy]"],
3333
"coreapi": ["coreapi>=2.0.0"],
3434
"markdown": ["types-Markdown>=0.1.5"],
3535
}

tests/typecheck/test_fields.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
5353
CharField(initial='', default=lambda: '')
5454
CharField(initial=None, default=4) # E: Argument "default" to "CharField" has incompatible type "int"; expected "Union[Union[str, _StrPromise], Callable[[], Union[str, _StrPromise]], None, _Empty]"
55-
CharField(initial={}, default=empty) # E: Argument "initial" to "CharField" has incompatible type "Dict[<nothing>, <nothing>]"; expected "Union[str, Callable[[], str], None, _Empty]"
55+
CharField(initial={}, default=empty) # E: Argument "initial" to "CharField" has incompatible type "Dict[Never, Never]"; expected "Union[str, Callable[[], str], None, _Empty]"
5656
5757
x: Optional[str] = CharField().get_initial()
5858
y: Optional[int] = CharField().get_initial() # E: Incompatible types in assignment (expression has type "Optional[str]", variable has type "Optional[int]")
@@ -123,13 +123,13 @@
123123
DictField(default={})
124124
DictField(default={'a': 1, 'b': 2})
125125
DictField(default=lambda: {'a': [], 'b': 'str'})
126-
DictField(default=[]) # E: Argument "default" to "DictField" has incompatible type "List[<nothing>]"; expected "Union[Dict[Any, Any], Callable[[], Dict[Any, Any]], None, _Empty]"
126+
DictField(default=[]) # E: Argument "default" to "DictField" has incompatible type "List[Never]"; expected "Union[Dict[Any, Any], Callable[[], Dict[Any, Any]], None, _Empty]"
127127
128128
JSONField(allow_null=True, default=None)
129129
JSONField(default={})
130130
JSONField(default={'a': 1, 'b': 2})
131131
JSONField(default=lambda: {'a': [], 'b': 'str'})
132-
JSONField(default=[]) # E: Argument "default" to "JSONField" has incompatible type "List[<nothing>]"; expected "Union[Mapping[Any, Any], Callable[[], Mapping[Any, Any]], None, _Empty]"
132+
JSONField(default=[]) # E: Argument "default" to "JSONField" has incompatible type "List[Never]"; expected "Union[Mapping[Any, Any], Callable[[], Mapping[Any, Any]], None, _Empty]"
133133
134134
- case: ListField_default
135135
main: |

tests/typecheck/test_serializers.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
- arg: ""
107107
err: No overload variant of "ReturnList" matches argument type "TestSerializer"
108108
- arg: "[],"
109-
err: No overload variant of "ReturnList" matches argument types "List[<nothing>]", "TestSerializer"
109+
err: No overload variant of "ReturnList" matches argument types "List[Never]", "TestSerializer"
110110
main: |
111111
from rest_framework import serializers
112112
from rest_framework.utils.serializer_helpers import ReturnList
@@ -125,7 +125,7 @@
125125
- arg: ""
126126
err: All overload variants of "ReturnList" require at least one argument
127127
- arg: "[]"
128-
err: No overload variant of "ReturnList" matches argument type "List[<nothing>]"
128+
err: No overload variant of "ReturnList" matches argument type "List[Never]"
129129
main: |
130130
from rest_framework import serializers
131131
from rest_framework.utils.serializer_helpers import ReturnList
@@ -176,9 +176,9 @@
176176
- arg: ""
177177
err: No overload variant of "ReturnDict" matches argument type "TestSerializer"
178178
- arg: "{},"
179-
err: No overload variant of "ReturnDict" matches argument types "Dict[<nothing>, <nothing>]", "TestSerializer"
179+
err: No overload variant of "ReturnDict" matches argument types "Dict[Never, Never]", "TestSerializer"
180180
- arg: "[],"
181-
err: No overload variant of "ReturnDict" matches argument types "List[<nothing>]", "TestSerializer"
181+
err: No overload variant of "ReturnDict" matches argument types "List[Never]", "TestSerializer"
182182
- arg: "[('a', 'a')],"
183183
err: No overload variant of "ReturnDict" matches argument types "List[Tuple[str, str]]", "TestSerializer"
184184
main: |
@@ -205,9 +205,9 @@
205205
- arg: ""
206206
err: All overload variants of "ReturnDict" require at least one argument
207207
- arg: "{}"
208-
err: No overload variant of "ReturnDict" matches argument type "Dict[<nothing>, <nothing>]"
208+
err: No overload variant of "ReturnDict" matches argument type "Dict[Never, Never]"
209209
- arg: "[]"
210-
err: No overload variant of "ReturnDict" matches argument type "List[<nothing>]"
210+
err: No overload variant of "ReturnDict" matches argument type "List[Never]"
211211
- arg: "[('a', 'a')]"
212212
err: No overload variant of "ReturnDict" matches argument type "List[Tuple[str, str]]"
213213
main: |

0 commit comments

Comments
 (0)