1010b = cast(str, a)
1111c = cast(int, a)
1212[out]
13- main:5: note : Redundant cast to "int"
13+ main:5: error : Redundant cast to "int"
1414
1515[case testRedundantCastWithIsinstance]
1616# flags: --warn-redundant-casts
@@ -20,7 +20,7 @@ if isinstance(x, str):
2020 cast(str, x)
2121[builtins fixtures/isinstance.pyi]
2222[out]
23- main:5: note : Redundant cast to "str"
23+ main:5: error : Redundant cast to "str"
2424
2525[case testCastToSuperclassNotRedundant]
2626# flags: --warn-redundant-casts
4545if int():
4646 a = 'a' # type: ignore
4747if int():
48- a = 2 # type: ignore # N : unused 'type: ignore' comment
48+ a = 2 # type: ignore # E : unused 'type: ignore' comment
4949if int():
5050 a = 'b' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
5151
@@ -57,8 +57,8 @@ from m import * # type: ignore
5757[file m.py]
5858pass
5959[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
6262
6363
6464-- No return
@@ -144,7 +144,7 @@ from typing import Any
144144def g() -> Any: pass
145145def f() -> int: return g()
146146[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"
148148
149149[case testReturnAnyForNotImplementedInBinaryMagicMethods]
150150# flags: --warn-return-any
@@ -159,7 +159,7 @@ class A:
159159 def some(self) -> bool: return NotImplemented
160160[builtins fixtures/notimplemented.pyi]
161161[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"
163163
164164[case testReturnAnyFromTypedFunctionWithSpecificFormatting]
165165# flags: --warn-return-any
@@ -174,7 +174,7 @@ typ = Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int,
174174def g() -> Any: pass
175175def f() -> typ: return g()
176176[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>
178178
179179[case testReturnAnySilencedFromTypedFunction]
180180# flags: --warn-return-any
0 commit comments