removed obsolete issues (many of them fixed with AE)
[docutils.git] / sandbox / tibs / pysource / test / test.py
blobb3e380526685f4f43ff317f132689682627b88e1
1 """A simple test file for input to ast-mining.py.
3 But it isn't a "raw" string, so:
5 \\*escape* \\`with` "\\\\"
6 """
8 __docformat__ = "reST"
10 import string
12 one = 1
14 """Documentation after `one` (intervening blank line)"""
16 two,three = 2,3
17 """Documenatation after ``two,three=2,3``"""
19 four,five = two,three
21 six = [four,five]
22 """Documentation after ``six=[four,five]``"""
24 global gmodule
25 gmodule = 1
26 """Global at the module level"""
28 def func(a,b=1,c='jim',d=None,e=[],f={'a':1},g=(1,2,3)):
29 r"""Function at the module level
31 This *is* a "raw" string, so:
33 \*escape* \`with` "\\"
34 """
36 from string import lstrip,rstrip
38 a = 3
40 global gfunc
41 gfunc = 1
42 """Global referenced only within `func()`"""
44 global one
45 one = 2
47 class InFunc:
48 pass
50 def infunc():
51 """Function defined inside function `func()`"""
52 global ginner
53 ginner = 1
54 """Global referenced only within `infunc()`"""
56 class Silly:
57 pass
59 def silly_fn():
60 pass
62 def func2(a,*args,**kargs):
63 pass
65 def func3((a,b,c),d):
66 pass
68 class Fred:
69 """Class at the module level."""
71 a = 1
72 """Documentation for class value `a`"""
74 global gclass
75 gclass = 2
76 """Global referenced only within `Fred`"""
78 def __init__(self):
79 """Initialisation for `Fred`"""
80 self.b = 2
81 """`self.b` within `Fred.__init__()`"""
83 c = 3
84 """Local variable within `Fred.__init__()`"""
86 global gmeth
87 gmeth = 3
88 """Global referenced only within a method"""
90 global gagain
91 gagain = 3
93 class Insider:
94 """Class defined inside `Fred.__init__()`"""
96 a = 'jim'
97 """Local name within class inside `Fred.__init__()`"""
99 global gclass2
100 gclass2 = 4
101 """Global referenced only within a class within a method"""
103 global gunused
104 global gagain
106 def fred(self):
107 global gunused2,gfunc2
108 gfunc2 = 5
109 """Global referenced only within a method in a
110 class in a method
113 def fredinner():
114 global ginner2
115 global gagain
116 ginner2 = 6
117 gagain = 6
119 infredinner = 7
121 class Jim(Fred):
122 pass