Make sure partialmethod tests are only executed for Python 3

This commit is contained in:
Dave Halter
2020-03-14 00:40:53 +01:00
parent 661fdb2b26
commit fd9a493868

View File

@@ -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