@@ -178,22 +178,46 @@ if int():
178178 def g(x): # E:5: Function is missing a type annotation
179179 pass
180180
181+ [case testPrettyFunctionMissingTypeAnnotation]
182+ # flags: --disallow-untyped-defs --pretty
183+ def function_with_long_name():
184+ pass
185+ [out]
186+ main:2:1: error: Function is missing a return type annotation
187+ def function_with_long_name():
188+ ^
189+ main:2:1: note: Use "-> None" if function does not return a value
190+
181191[case testColumnEndFunctionMissingTypeAnnotation]
182192# flags: --disallow-untyped-defs --show-error-end
183193from typing import Any, Optional
184194if int():
185- def f(x: int, foo: Optional[str]):
195+ def f():
196+ pass
197+
198+ def f_no_return(x: int, foo: Optional[str]):
199+ pass
200+
201+ def f_default(x: int, foo: Optional[str] = None):
202+ pass
203+
204+ def f_default_untyped(x, foo = None):
186205 pass
187206
188- def g(x: int, foo: Optional[str] = None ):
207+ def f_args(x, *args ):
189208 pass
190209
191- def h (x, foo = None ):
210+ def f_kwargs (x, *args, **kwargs ):
192211 pass
212+ [builtins fixtures/tuple.pyi]
193213[out]
194- main:4:5:4:37: error: Function is missing a return type annotation
195- main:7:5:7:44: error: Function is missing a return type annotation
196- main:10:5:10:24: error: Function is missing a type annotation
214+ main:4:5:4:5: error: Function is missing a return type annotation
215+ main:4:5:4:5: note: Use "-> None" if function does not return a value
216+ main:7:5:7:47: error: Function is missing a return type annotation
217+ main:10:5:10:52: error: Function is missing a return type annotation
218+ main:13:5:13:40: error: Function is missing a type annotation
219+ main:16:5:16:24: error: Function is missing a type annotation
220+ main:19:5:19:36: error: Function is missing a type annotation
197221
198222[case testColumnNameIsNotDefined]
199223((x)) # E:3: Name "x" is not defined
0 commit comments