Mercurial > cpython-lru_cache-weakref
annotate Lib/test/inspect_fodder2.py @ 78069:a8aa77458e12 3.2
Add c_size_t and c_ssize_t to the ctypes summary table.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 12 Jul 2012 20:31:50 +0200 |
| parents | 0b1a8f56117a |
| children |
| rev | line source |
|---|---|
|
34151
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
1 # line 1 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
2 def wrap(foo=None): |
|
34358
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
3 def wrapper(func): |
|
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
4 return func |
|
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
5 return wrapper |
|
34151
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
6 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
7 # line 7 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
8 def replace(func): |
|
34358
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
9 def insteadfunc(): |
|
40775
4cdf21a0dbbc
Fix most trivially-findable print statements.
Guido van Rossum <guido@python.org>
parents:
39610
diff
changeset
|
10 print('hello') |
|
34358
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
11 return insteadfunc |
|
34151
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
12 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
13 # line 13 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
14 @wrap() |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
15 @wrap(wrap) |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
16 def wrapped(): |
|
34358
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
17 pass |
|
34151
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
18 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
19 # line 19 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
20 @replace |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
21 def gone(): |
|
34358
b1a84233d855
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
34152
diff
changeset
|
22 pass |
|
34152
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
23 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
24 # line 24 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
25 oll = lambda m: m |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
26 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
27 # line 27 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
28 tll = lambda g: g and \ |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
29 g and \ |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
30 g |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
31 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
32 # line 32 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
33 tlli = lambda d: d and \ |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
34 d |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
35 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
36 # line 36 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
37 def onelinefunc(): pass |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
38 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
39 # line 39 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
40 def manyargs(arg1, arg2, |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
41 arg3, arg4): pass |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
42 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
43 # line 43 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
44 def twolinefunc(m): return m and \ |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
45 m |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
46 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
47 # line 47 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
48 a = [None, |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
49 lambda x: x, |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
50 None] |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
51 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
52 # line 52 |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
53 def setfunc(func): |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
54 globals()["anonymous"] = func |
|
bbdaacc44f6f
Patch #1011890: fix inspect.getsource breaking with line-continuation &
Johannes Gijsbers <jlg@dds.nl>
parents:
34151
diff
changeset
|
55 setfunc(lambda x, y: x*y) |
|
34740
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
56 |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
57 # line 57 |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
58 def with_comment(): # hello |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
59 world |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
60 |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
61 # line 61 |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
62 multiline_sig = [ |
|
41717
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
40775
diff
changeset
|
63 lambda x, \ |
|
9ad84070b22d
Merged revisions 55328-55341 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
40775
diff
changeset
|
64 y: x+y, |
|
34740
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
65 None, |
|
3bb759498767
Patch #1159931/bug #1143895: inspect.getsource failed when functions,
Johannes Gijsbers <jlg@dds.nl>
parents:
34358
diff
changeset
|
66 ] |
|
35640
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
67 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
68 # line 68 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
69 def func69(): |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
70 class cls70: |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
71 def func71(): |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
72 pass |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
73 return cls70 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
74 extra74 = 74 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
75 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
76 # line 76 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
77 def func77(): pass |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
78 (extra78, stuff78) = 'xy' |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
79 extra79 = 'stop' |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
80 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
81 # line 81 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
82 class cls82: |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
83 def func83(): pass |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
84 (extra84, stuff84) = 'xy' |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
85 extra85 = 'stop' |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
86 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
87 # line 87 |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
88 def func88(): |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
89 # comment |
|
1e7b755194a4
some more fixes and tests for inspect.getsource(), triggered by crashes
Armin Rigo <arigo@tunes.org>
parents:
34740
diff
changeset
|
90 return 90 |
|
39610
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
91 |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
92 # line 92 |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
93 def f(): |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
94 class X: |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
95 def g(): |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
96 "doc" |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
97 return 42 |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
35640
diff
changeset
|
98 return X |
|
44021
ff5df1fc0fcc
Patch from Georg Brandl and me for #1493
Christian Heimes <christian@cheimes.de>
parents:
43796
diff
changeset
|
99 method_in_dynamic_class = f().g |
|
43796
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
100 |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
101 #line 101 |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
102 def keyworded(*arg1, arg2=1): |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
103 pass |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
104 |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
105 #line 105 |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
106 def annotated(arg1: list): |
|
7022affd7bd0
Applied patch #1127 from Quentin Gallet Gilles: No tests for inspect.getfullargspec()
Christian Heimes <christian@cheimes.de>
parents:
41717
diff
changeset
|
107 pass |
|
50817
0b1a8f56117a
fix inspect.formatargspec on functions with keyword-only arguments without defaults #4959
Benjamin Peterson <benjamin@python.org>
parents:
44021
diff
changeset
|
108 |
|
0b1a8f56117a
fix inspect.formatargspec on functions with keyword-only arguments without defaults #4959
Benjamin Peterson <benjamin@python.org>
parents:
44021
diff
changeset
|
109 #line 109 |
|
0b1a8f56117a
fix inspect.formatargspec on functions with keyword-only arguments without defaults #4959
Benjamin Peterson <benjamin@python.org>
parents:
44021
diff
changeset
|
110 def keyword_only_arg(*, arg): |
|
0b1a8f56117a
fix inspect.formatargspec on functions with keyword-only arguments without defaults #4959
Benjamin Peterson <benjamin@python.org>
parents:
44021
diff
changeset
|
111 pass |
