mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Disable some tests that don't run in 2.6, because its syntax doesn't support it.
This commit is contained in:
@@ -136,24 +136,6 @@ ret(1)[0]
|
|||||||
#? str() set()
|
#? str() set()
|
||||||
ret()[0]
|
ret()[0]
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# with statements
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
with open('') as f:
|
|
||||||
#? ['closed']
|
|
||||||
f.closed
|
|
||||||
for line in f:
|
|
||||||
#? str()
|
|
||||||
line
|
|
||||||
|
|
||||||
with open('') as f1, open('') as f2:
|
|
||||||
#? ['closed']
|
|
||||||
f1.closed
|
|
||||||
#? ['closed']
|
|
||||||
f2.closed
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# global vars
|
# global vars
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -291,3 +273,23 @@ foo
|
|||||||
__file__
|
__file__
|
||||||
#? ['__file__']
|
#? ['__file__']
|
||||||
__file__
|
__file__
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# with statements
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
with open('') as f:
|
||||||
|
#? ['closed']
|
||||||
|
f.closed
|
||||||
|
for line in f:
|
||||||
|
#? str()
|
||||||
|
line
|
||||||
|
|
||||||
|
# Nested with statements don't exist in Python 2.6.
|
||||||
|
# python >= 2.7
|
||||||
|
with open('') as f1, open('') as f2:
|
||||||
|
#? ['closed']
|
||||||
|
f1.closed
|
||||||
|
#? ['closed']
|
||||||
|
f2.closed
|
||||||
|
|||||||
@@ -61,10 +61,6 @@ listen(['' for x in [1]])
|
|||||||
#?
|
#?
|
||||||
([str for x in []])[0]
|
([str for x in []])[0]
|
||||||
|
|
||||||
# with a set literal
|
|
||||||
#? int()
|
|
||||||
[a for a in {1, 2, 3}][0]
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# nested list comprehensions
|
# nested list comprehensions
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -133,6 +129,46 @@ left
|
|||||||
#? int()
|
#? int()
|
||||||
right
|
right
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# name resolution in comprehensions.
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
def x():
|
||||||
|
"""Should not try to resolve to the if hio, which was a bug."""
|
||||||
|
#? 22
|
||||||
|
[a for a in h if hio]
|
||||||
|
if hio: pass
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# slices
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
#? list()
|
||||||
|
foo = [x for x in [1, '']][:1]
|
||||||
|
#? int()
|
||||||
|
foo[0]
|
||||||
|
#? str()
|
||||||
|
foo[1]
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# In class
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
class X():
|
||||||
|
def __init__(self, bar):
|
||||||
|
self.bar = bar
|
||||||
|
|
||||||
|
def foo(self):
|
||||||
|
x = [a for a in self.bar][0]
|
||||||
|
#? int()
|
||||||
|
x
|
||||||
|
return x
|
||||||
|
|
||||||
|
#? int()
|
||||||
|
X([1]).foo()
|
||||||
|
|
||||||
|
# set/dict comprehensions were introduced in 2.7, therefore:
|
||||||
|
# python >= 2.7
|
||||||
# -----------------
|
# -----------------
|
||||||
# dict comprehensions
|
# dict comprehensions
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -174,40 +210,6 @@ d[2]
|
|||||||
next(iter({a for a in range(10)}))
|
next(iter({a for a in range(10)}))
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# with a set literal (also doesn't work in 2.6).
|
||||||
# name resolution in comprehensions.
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
def x():
|
|
||||||
"""Should not try to resolve to the if hio, which was a bug."""
|
|
||||||
#? 22
|
|
||||||
[a for a in h if hio]
|
|
||||||
if hio: pass
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# slices
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
#? list()
|
|
||||||
foo = [x for x in [1, '']][:1]
|
|
||||||
#? int()
|
#? int()
|
||||||
foo[0]
|
[a for a in {1, 2, 3}][0]
|
||||||
#? str()
|
|
||||||
foo[1]
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# In class
|
|
||||||
# -----------------
|
|
||||||
|
|
||||||
class X():
|
|
||||||
def __init__(self, bar):
|
|
||||||
self.bar = bar
|
|
||||||
|
|
||||||
def foo(self):
|
|
||||||
x = [a for a in self.bar][0]
|
|
||||||
#? int()
|
|
||||||
x
|
|
||||||
return x
|
|
||||||
|
|
||||||
#? int()
|
|
||||||
X([1]).foo()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user