From fd9a4938684bc51e9273b0e8cf7fb42a9f34d008 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 14 Mar 2020 00:40:53 +0100 Subject: [PATCH] Make sure partialmethod tests are only executed for Python 3 --- test/completion/stdlib.py | 82 ++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/test/completion/stdlib.py b/test/completion/stdlib.py index 9de3f839..704afd24 100644 --- a/test/completion/stdlib.py +++ b/test/completion/stdlib.py @@ -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