Debian Codegraph @

test/completion/goto.py

raw symbols SCIP
1 # goto command tests are different in syntax
2
3 definition = 3
4 #! 0 ['a = definition']
5 a = definition
6
7 #! []
8 b
9 #! ['a = definition']
10 a
11
12 b = a
13 c = b
14 #! ['c = b']
15 c
16
17 cd = 1
18 #! 1 ['cd = c']
19 cd = c
20 #! 0 ['cd = e']
21 cd = e
22
23 #! ['module math']
24 import math
25 #! ['module math']
26 math
27
28 #! ['module math']
29 b = math
30 #! ['b = math']
31 b
32
33 #! 18 ['foo = 10']
34 foo = 10;print(foo)
35
36 # -----------------
37 # classes
38 # -----------------
39 class C(object):
40 x = 3
41 def b(self):
42 #! ['b = math']
43 b
44 #! ['def b']
45 self.b
46 #! 14 ['def b']
47 self.b()
48 #! 14 ['def b']
49 self.b.
50 #! 11 ['param self']
51 self.b
52 #! ['x = 3']
53 self.x
54 #! 14 ['x = 3']
55 self.x.
56 return 1
57
58 #! ['def b']
59 b
60
61 #! ['b = math']
62 b
63
64 #! ['def b']
65 C.b
66 #! ['def b']
67 C().b
68 #! 0 ['class C']
69 C().b
70 #! 0 ['class C']
71 C().b
72
73 D = C
74 #! ['def b']
75 D.b
76 #! ['def b']
77 D().b
78
79 #! 0 ['D = C']
80 D().b
81 #! 0 ['D = C']
82 D().b
83
84 def c():
85 return ''
86
87 #! ['def c']
88 c
89 #! 0 ['def c']
90 c()
91
92
93 class ClassVar():
94 x = 3
95
96 #! ['x = 3']
97 ClassVar.x
98 #! ['x = 3']
99 ClassVar().x
100
101 # before assignments
102 #! 10 ['x = 3']
103 ClassVar.x = ''
104 #! 12 ['x = 3']
105 ClassVar().x = ''
106
107 # Recurring use of the same var name, github #315
108 def f(t=None):
109 #! 9 ['param t=None']
110 t = t or 1
111
112
113 class X():
114 pass
115
116 #! 3 []
117 X(foo=x)
118
119
120 # Multiple inheritance
121 class Foo:
122 def foo(self):
123 print("foo")
124 class Bar:
125 def bar(self):
126 print("bar")
127 class Baz(Foo, Bar):
128 def baz(self):
129 #! ['def foo']
130 super().foo
131 #! ['def bar']
132 super().bar
133 #! ['instance Foo']
134 super()
135
136 # -----------------
137 # imports
138 # -----------------
139
140 #! ['module import_tree']
141 import import_tree
142 #! ["a = ''"]
143 import_tree.a
144
145 #! ['module mod1']
146 import import_tree.mod1
147 #! ['module mod1']
148 from import_tree.mod1
149 #! ['a = 1']
150 import_tree.mod1.a
151
152 #! ['module pkg']
153 import import_tree.pkg
154 #! ['a = list']
155 import_tree.pkg.a
156
157 #! ['module mod1']
158 import import_tree.pkg.mod1
159 #! ['a = 1.0']
160 import_tree.pkg.mod1.a
161 #! ["a = ''"]
162 import_tree.a
163
164 #! ['module mod1']
165 from import_tree.pkg import mod1
166 #! ['a = 1.0']
167 mod1.a
168
169 #! ['module mod1']
170 from import_tree import mod1
171 #! ['a = 1']
172 mod1.a
173
174 #! ['a = 1.0']
175 from import_tree.pkg.mod1 import a
176
177 #! ['module os']
178 from .imports import os
179
180 #! ['some_variable = 1']
181 from . import some_variable
182
183 # -----------------
184 # anonymous classes
185 # -----------------
186 def func():
187 class A():
188 def b(self):
189 return 1
190 return A()
191
192 #! 8 ['def b']
193 func().b()
194
195 # -----------------
196 # on itself
197 # -----------------
198
199 #! 7 ['class ClassDef']
200 class ClassDef():
201 """ abc """
202 pass
203
204 # -----------------
205 # params
206 # -----------------
207
208 param = ClassDef
209 #! 8 ['param param']
210 def ab1(param): pass
211 #! 9 ['param param']
212 def ab2(param): pass
213 #! 11 ['param = ClassDef']
214 def ab3(a=param): pass
215
216 ab1(ClassDef);ab2(ClassDef);ab3(ClassDef)
217
218 # -----------------
219 # for loops
220 # -----------------
221
222 for i in range(1):
223 #! ['for i in range(1): i']
224 i
225
226 for key, value in [(1,2)]:
227 #! ['for key, value in [(1,2)]: key']
228 key
229
230 #! 4 ['for y in [1]: y']
231 for y in [1]:
232 #! ['for y in [1]: y']
233 y
234
235 # -----------------
236 # decorator
237 # -----------------
238 def dec(dec_param=3):
239 pass
240
241 #! 8 ['param dec_param=3']
242 @dec(dec_param=5)
243 def y():
244 pass
245
246 class ClassDec():
247 def class_func(func):
248 return func
249
250 #! 14 ['def class_func']
251 @ClassDec.class_func
252 def x():
253 pass
254
255 #! 2 ['class ClassDec']
256 @ClassDec.class_func
257 def z():
258 pass