mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make sure partialmethod tests are only executed for Python 3
This commit is contained in:
@@ -158,46 +158,6 @@ tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
class X:
|
||||
def function(self, a, b):
|
||||
return a, b
|
||||
a = functools.partialmethod(function, 0)
|
||||
kw = functools.partialmethod(function, b=1.0)
|
||||
|
||||
#? int()
|
||||
X().a('')[0]
|
||||
#? str()
|
||||
X().a('')[1]
|
||||
|
||||
#? int()
|
||||
X.a('')[0]
|
||||
#? str()
|
||||
X.a('')[1]
|
||||
|
||||
#? int()
|
||||
X.a(X(), '')[0]
|
||||
#? str()
|
||||
X.a(X(), '')[1]
|
||||
|
||||
tup = X().kw(1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
tup = X.kw(1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
tup = X.kw(X(), 1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
|
||||
def my_decorator(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwds):
|
||||
@@ -423,6 +383,48 @@ X().name
|
||||
#? float()
|
||||
X().attr_x.attr_y.value
|
||||
|
||||
# -----------------
|
||||
# functools Python 3.5+
|
||||
# -----------------
|
||||
class X:
|
||||
def function(self, a, b):
|
||||
return a, b
|
||||
a = functools.partialmethod(function, 0)
|
||||
kw = functools.partialmethod(function, b=1.0)
|
||||
|
||||
#? int()
|
||||
X().a('')[0]
|
||||
#? str()
|
||||
X().a('')[1]
|
||||
|
||||
#? int()
|
||||
X.a('')[0]
|
||||
#? str()
|
||||
X.a('')[1]
|
||||
|
||||
#? int()
|
||||
X.a(X(), '')[0]
|
||||
#? str()
|
||||
X.a(X(), '')[1]
|
||||
|
||||
tup = X().kw(1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
tup = X.kw(1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
tup = X.kw(X(), 1)
|
||||
#? int()
|
||||
tup[0]
|
||||
#? float()
|
||||
tup[1]
|
||||
|
||||
|
||||
# -----------------
|
||||
# functools Python 3.8
|
||||
|
||||
Reference in New Issue
Block a user