blob: 5a7b559d07d7628dcf4ff42fb27c434623d8a9a8 [file] [log] [blame]
Johannes Gijsberscb9015d2004-12-12 16:20:22 +00001# line 1
2def wrap(foo=None):
Tim Peters5a9fb3c2005-01-07 16:01:32 +00003 def wrapper(func):
4 return func
5 return wrapper
Johannes Gijsberscb9015d2004-12-12 16:20:22 +00006
7# line 7
8def replace(func):
Tim Peters5a9fb3c2005-01-07 16:01:32 +00009 def insteadfunc():
Guido van Rossumbe19ed72007-02-09 05:37:30 +000010 print('hello')
Tim Peters5a9fb3c2005-01-07 16:01:32 +000011 return insteadfunc
Johannes Gijsberscb9015d2004-12-12 16:20:22 +000012
13# line 13
14@wrap()
15@wrap(wrap)
16def wrapped():
Tim Peters5a9fb3c2005-01-07 16:01:32 +000017 pass
Johannes Gijsberscb9015d2004-12-12 16:20:22 +000018
19# line 19
20@replace
21def gone():
Tim Peters5a9fb3c2005-01-07 16:01:32 +000022 pass
Johannes Gijsbers1542f342004-12-12 16:46:28 +000023
24# line 24
25oll = lambda m: m
26
27# line 27
28tll = lambda g: g and \
29g and \
30g
31
32# line 32
33tlli = lambda d: d and \
34 d
35
36# line 36
37def onelinefunc(): pass
38
39# line 39
40def manyargs(arg1, arg2,
41arg3, arg4): pass
42
43# line 43
44def twolinefunc(m): return m and \
45m
46
47# line 47
48a = [None,
49 lambda x: x,
50 None]
51
52# line 52
53def setfunc(func):
54 globals()["anonymous"] = func
55setfunc(lambda x, y: x*y)
Johannes Gijsbersa5855d52005-03-12 16:37:11 +000056
57# line 57
58def with_comment(): # hello
59 world
60
61# line 61
62multiline_sig = [
Guido van Rossum1bc535d2007-05-15 18:46:22 +000063 lambda x, \
64 y: x+y,
Johannes Gijsbersa5855d52005-03-12 16:37:11 +000065 None,
66 ]
Armin Rigodd5c0232005-09-25 11:45:45 +000067
68# line 68
69def func69():
70 class cls70:
71 def func71():
72 pass
73 return cls70
74extra74 = 74
75
76# line 76
77def func77(): pass
78(extra78, stuff78) = 'xy'
79extra79 = 'stop'
80
81# line 81
82class cls82:
83 def func83(): pass
84(extra84, stuff84) = 'xy'
85extra85 = 'stop'
86
87# line 87
88def func88():
89 # comment
90 return 90
Thomas Wouters00ee7ba2006-08-21 19:07:27 +000091
92# line 92
93def f():
94 class X:
95 def g():
96 "doc"
97 return 42
98 return X
Christian Heimes4a22b5d2007-11-25 09:39:14 +000099method_in_dynamic_class = f().g
Christian Heimes3795b532007-11-08 13:48:53 +0000100
101#line 101
102def keyworded(*arg1, arg2=1):
103 pass
104
105#line 105
106def annotated(arg1: list):
107 pass
Benjamin Peterson9953a8d2009-01-17 04:15:01 +0000108
109#line 109
110def keyword_only_arg(*, arg):
111 pass
Yury Selivanov081bbf62014-09-26 17:34:54 -0400112
Antoine Pitroua8723a02015-04-15 00:41:29 +0200113@wrap(lambda: None)
114def func114():
115 return 115
116
117class ClassWithMethod:
118 def method(self):
119 pass
120
Yury Selivanov081bbf62014-09-26 17:34:54 -0400121from functools import wraps
122
123def decorator(func):
124 @wraps(func)
125 def fake():
126 return 42
127 return fake
128
Antoine Pitroua8723a02015-04-15 00:41:29 +0200129#line 129
Yury Selivanov081bbf62014-09-26 17:34:54 -0400130@decorator
131def real():
132 return 20
Yury Selivanov4f4913b2015-07-23 17:10:00 +0300133
134#line 134
135class cls135:
136 def func136():
137 def func137():
138 never_reached1
139 never_reached2
Pablo Galindo8c77b8c2019-04-29 13:36:57 +0100140
141#line 141
142def positional_only_arg(a, /):
143 pass
144
145#line 145
146def all_markers(a, b, /, c, d, *, e, f):
147 pass
148
149# line 149
150def all_markers_with_args_and_kwargs(a, b, /, c, d, *args, e, f, **kwargs):
151 pass
152
153#line 153
154def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5):
155 pass