Mercurial > cpython-lru_cache-weakref
annotate Lib/test/inspect_fodder.py @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | ff040880d1be |
| children | 408165aced01 |
| 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 |
|
58669
ff040880d1be
#7092: Silence more py3k warnings. Patch by Florent Xicluna.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
58198
diff
changeset
|
18 q = y // 0 |
|
34151
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 |
