Debian Codegraph @

test/completion/invalid.py

raw symbols SCIP
1 """
2 This file is less about the results and much more about the fact, that no
3 exception should be thrown.
4
5 Basically this file could change depending on the current implementation. But
6 there should never be any errors.
7 """
8
9 # wait until keywords are out of definitions (pydoc function).
10 #? 5
11 's'()
12
13 #? []
14 str()).upper
15
16 # -----------------
17 # funcs
18 # -----------------
19 def asdf(a or b): # multiple param names
20 return a
21
22 #?
23 asdf(2)
24
25 asdf = ''
26
27 from a import (b
28 def blub():
29 return 0
30 def wrong_indents():
31 asdf = 3
32 asdf
33 asdf(
34 # TODO this seems to be wrong now?
35 #? int()
36 asdf
37 def openbrace():
38 asdf = 3
39 asdf(
40 #? int()
41 asdf
42 return 1
43
44 #? int()
45 openbrace()
46
47 blub([
48 #? int()
49 openbrace()
50
51 def indentfault():
52 asd(
53 indentback
54
55 #? []
56 indentfault().
57
58 def openbrace2():
59 asd(
60 def normalfunc():
61 return 1
62
63 #? int()
64 normalfunc()
65
66 # dots in param
67 def f(seq1...=None):
68 return seq1
69 #?
70 f(1)
71
72 @
73 def test_empty_decorator():
74 return 1
75
76 #? int()
77 test_empty_decorator()
78
79 def invalid_param(param=):
80 #?
81 param
82 # -----------------
83 # flows
84 # -----------------
85
86 # first part not complete (raised errors)
87 if a
88 a
89 else:
90 #? ['AttributeError']
91 AttributeError
92
93 try
94 #? ['AttributeError']
95 except AttributeError
96 pass
97 finally:
98 pass
99
100 #? ['isinstance']
101 if isi
102 try:
103 except TypeError:
104 #? str()
105 str()
106
107 def break(): pass
108 # wrong ternary expression
109 a = ''
110 a = 1 if
111 #? str()
112 a
113
114 # No completions for for loops without the right syntax
115 for for_local in :
116 for_local
117 #? []
118 for_local
119 #?
120 for_local
121
122
123 # -----------------
124 # list comprehensions
125 # -----------------
126
127 a2 = [for a2 in [0]]
128 #?
129 a2[0]
130
131 a3 = [for xyz in]
132 #?
133 a3[0]
134
135 a3 = [a4 for in 'b']
136 #?
137 a3[0]
138
139 a3 = [a4 for a in for x in y]
140 #?
141 a3[0]
142
143 a = [for a in
144 def break(): pass
145
146 #? str()
147 a[0]
148
149 a = [a for a in [1,2]
150 def break(): pass
151 #? str()
152 a[0]
153
154 #? []
155 int()).real
156
157 # -----------------
158 # keywords
159 # -----------------
160
161 #! []
162 as
163
164 def empty_assert():
165 x = 3
166 assert
167 #? int()
168 x
169
170 import datetime as
171
172
173 # -----------------
174 # statements
175 # -----------------
176
177 call = ''
178 invalid = .call
179 #?
180 invalid
181
182 invalid = call?.call
183 #? str()
184 invalid
185
186 # comma
187 invalid = ,call
188 #? str()
189 invalid
190
191
192 # -----------------
193 # classes
194 # -----------------
195
196 class BrokenPartsOfClass():
197 def foo(self):
198 # This construct contains two places where Jedi with Python 3 can fail.
199 # It should just ignore those constructs and still execute `bar`.
200 pass
201 if 2:
202 try:
203 pass
204 except ValueError, e:
205 raise TypeError, e
206 else:
207 pass
208
209 def bar(self):
210 self.x = 3
211 return ''
212
213 #? str()
214 BrokenPartsOfClass().bar()