Mercurial > cpython-lru_cache-weakref
annotate Lib/test/inspect_fodder.py @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | de4701fc176f |
| children | 9ad84070b22d 7caf54ce529e |
| 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 'A module docstring.' |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
3 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
4 import sys, inspect |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
5 # line 5 |
|
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 spam(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
9 eggs(b + d, c + f) |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
10 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
11 # line 11 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
12 def eggs(x, y): |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
13 "A docstring." |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
14 global fr, st |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
15 fr = inspect.currentframe() |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
16 st = inspect.stack() |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
17 p = x |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
18 q = y / 0 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
19 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
20 # line 20 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
21 class StupidGit: |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
22 """A longer, |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
23 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
24 indented |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
25 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
26 docstring.""" |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
27 # line 27 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
28 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
29 def abuse(self, a, b, c): |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
30 """Another |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
31 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
32 \tdocstring |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
33 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
34 containing |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
35 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
36 \ttabs |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
37 \t |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
38 """ |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
39 self.argue(a, b, c) |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
40 # line 40 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
41 def argue(self, a, b, c): |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
42 try: |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
43 spam(a, b, c) |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
44 except: |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
45 self.ex = sys.exc_info() |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
46 self.tr = inspect.trace() |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
47 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
48 # line 48 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
49 class MalodorousPervert(StupidGit): |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
50 pass |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
51 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
52 class ParrotDroppings: |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
53 pass |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
54 |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
55 class FesteringGob(MalodorousPervert, ParrotDroppings): |
|
de4701fc176f
Patch #736962: port test_inspect to unittest. As part of this, move out
Johannes Gijsbers <jlg@dds.nl>
parents:
diff
changeset
|
56 pass |
