mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-10 05:52:22 +08:00
tuple support without braces
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
# -----------------
|
||||
# basic array lookups
|
||||
# -----------------
|
||||
|
||||
#? ['imag']
|
||||
[1,2][0].imag
|
||||
[1,""][0].imag
|
||||
#? []
|
||||
[1,""][1].imag
|
||||
|
||||
a = list()
|
||||
#? ['append']
|
||||
@@ -10,14 +15,52 @@ a = list()
|
||||
[[a]][0][100].append
|
||||
|
||||
|
||||
# -----------------
|
||||
# tuple assignments
|
||||
# -----------------
|
||||
a1, b1 = (1, "")
|
||||
#? ['real']
|
||||
a1.real
|
||||
#? ['lower']
|
||||
b1.lower
|
||||
#? []
|
||||
b1.real
|
||||
|
||||
(a2, b2) = (1, "")
|
||||
#? ['imag']
|
||||
a2.imag
|
||||
#? ['upper']
|
||||
b2.upper
|
||||
|
||||
# -----------------
|
||||
# subtuple assignment
|
||||
# -----------------
|
||||
(a3, (b3, c3)) = (1, ("", list))
|
||||
##? ['append']
|
||||
c3.append
|
||||
#? []
|
||||
c3.upper
|
||||
#? []
|
||||
c3.real
|
||||
|
||||
a4, (b4, c4) = (1, ("", list))
|
||||
#? ['append']
|
||||
c4.append
|
||||
#? []
|
||||
c4.upper
|
||||
#? []
|
||||
c4.real
|
||||
#? ['real']
|
||||
a4.real
|
||||
#? ['upper']
|
||||
b4.upper
|
||||
|
||||
|
||||
# -----------------
|
||||
# unnessecary braces
|
||||
# -----------------
|
||||
u, v = 1, ""
|
||||
#? ['real']
|
||||
u.real
|
||||
#? []
|
||||
u.upper
|
||||
|
||||
@@ -14,7 +14,7 @@ with open('') as f1, open('') as f2:
|
||||
|
||||
|
||||
def global_define():
|
||||
#global glob
|
||||
global glob
|
||||
glob = 3
|
||||
|
||||
#? ['real']
|
||||
|
||||
@@ -68,3 +68,11 @@ tup2 = tuple()
|
||||
tup2.i
|
||||
##? ['index'] TODO enable
|
||||
().i
|
||||
|
||||
tup3 = 1,""
|
||||
#? ['index']
|
||||
tup3.index
|
||||
|
||||
tup4 = 1,""
|
||||
#? ['index']
|
||||
tup4.index
|
||||
|
||||
@@ -43,8 +43,8 @@ def completion_test(source):
|
||||
# TODO remove set! duplicates should not be normal
|
||||
comp_str = str(sorted(set([str(c) for c in completions])))
|
||||
if comp_str != correct:
|
||||
print 'Solution not correct, received %s, wanted %s' % \
|
||||
(comp_str, correct)
|
||||
print 'Solution on %s not correct, received %s, wanted %s'\
|
||||
% (line_nr, comp_str, correct)
|
||||
#print [(c.name, c.name.parent) for c in completions]
|
||||
fails += 1
|
||||
correct = None
|
||||
|
||||
Reference in New Issue
Block a user