10
10
b = cast(str, a)
11
11
c = cast(int, a)
12
12
[out]
13
- main:5: note : Redundant cast to "int"
13
+ main:5: error : Redundant cast to "int"
14
14
15
15
[case testRedundantCastWithIsinstance]
16
16
# flags: --warn-redundant-casts
@@ -20,7 +20,7 @@ if isinstance(x, str):
20
20
cast(str, x)
21
21
[builtins fixtures/isinstance.pyi]
22
22
[out]
23
- main:5: note : Redundant cast to "str"
23
+ main:5: error : Redundant cast to "str"
24
24
25
25
[case testCastToSuperclassNotRedundant]
26
26
# flags: --warn-redundant-casts
45
45
if int():
46
46
a = 'a' # type: ignore
47
47
if int():
48
- a = 2 # type: ignore # N : unused 'type: ignore' comment
48
+ a = 2 # type: ignore # E : unused 'type: ignore' comment
49
49
if int():
50
50
a = 'b' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
51
51
@@ -57,8 +57,8 @@ from m import * # type: ignore
57
57
[file m.py]
58
58
pass
59
59
[out]
60
- main:3: note : unused 'type: ignore' comment
61
- main:4: note : unused 'type: ignore' comment
60
+ main:3: error : unused 'type: ignore' comment
61
+ main:4: error : unused 'type: ignore' comment
62
62
63
63
64
64
-- No return
@@ -144,7 +144,7 @@ from typing import Any
144
144
def g() -> Any: pass
145
145
def f() -> int: return g()
146
146
[out]
147
- main:4: warning : Returning Any from function declared to return "int"
147
+ main:4: error : Returning Any from function declared to return "int"
148
148
149
149
[case testReturnAnyForNotImplementedInBinaryMagicMethods]
150
150
# flags: --warn-return-any
@@ -159,7 +159,7 @@ class A:
159
159
def some(self) -> bool: return NotImplemented
160
160
[builtins fixtures/notimplemented.pyi]
161
161
[out]
162
- main:3: warning : Returning Any from function declared to return "bool"
162
+ main:3: error : Returning Any from function declared to return "bool"
163
163
164
164
[case testReturnAnyFromTypedFunctionWithSpecificFormatting]
165
165
# flags: --warn-return-any
@@ -174,7 +174,7 @@ typ = Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int,
174
174
def g() -> Any: pass
175
175
def f() -> typ: return g()
176
176
[out]
177
- main:11: warning : Returning Any from function declared to return <tuple: 91 items>
177
+ main:11: error : Returning Any from function declared to return <tuple: 91 items>
178
178
179
179
[case testReturnAnySilencedFromTypedFunction]
180
180
# flags: --warn-return-any
0 commit comments