mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Some class lambdas tests too assure that they are working well with instances.
This commit is contained in:
@@ -55,11 +55,26 @@ a = lambda: 3
|
|||||||
a.__closure__
|
a.__closure__
|
||||||
|
|
||||||
class C():
|
class C():
|
||||||
def __init__(self):
|
def __init__(self, foo=1.0):
|
||||||
self.a = lambda: 1
|
self.a = lambda: 1
|
||||||
|
self.foo = foo
|
||||||
|
|
||||||
|
def ret(self):
|
||||||
|
return lambda: self.foo
|
||||||
|
|
||||||
|
def with_param(self):
|
||||||
|
return lambda x: x + self.a()
|
||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
C().a()
|
C().a()
|
||||||
|
|
||||||
|
#? str()
|
||||||
|
C('foo').ret()()
|
||||||
|
|
||||||
|
index = C().with_param()(1)
|
||||||
|
#? float()
|
||||||
|
['', 1, 1.0][index]
|
||||||
|
|
||||||
|
|
||||||
def xy(param):
|
def xy(param):
|
||||||
def ret(a, b):
|
def ret(a, b):
|
||||||
|
|||||||
Reference in New Issue
Block a user