mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
move decorator tests
This commit is contained in:
@@ -173,55 +173,6 @@ exe[3].items
|
||||
#? set()
|
||||
exe[3]['c']
|
||||
|
||||
# -----------------
|
||||
# decorators
|
||||
# -----------------
|
||||
|
||||
def decorator(func):
|
||||
def wrapper(*args):
|
||||
return func(1, *args)
|
||||
return wrapper
|
||||
|
||||
@decorator
|
||||
def decorated(a,b):
|
||||
return a,b
|
||||
|
||||
exe = decorated(set, '')
|
||||
|
||||
#? set
|
||||
exe[1]
|
||||
|
||||
#? int()
|
||||
exe[0]
|
||||
|
||||
# more complicated with args/kwargs
|
||||
def dec(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
@dec
|
||||
def fu(a, b, c, *args, **kwargs):
|
||||
return a, b, c, args, kwargs
|
||||
|
||||
exe = fu(list, c=set, b=3, d='')
|
||||
|
||||
#? ['append']
|
||||
exe[0].append
|
||||
#? ['real']
|
||||
exe[1].real
|
||||
#? ['union']
|
||||
exe[2].union
|
||||
|
||||
#? str()
|
||||
exe[4]['d']
|
||||
|
||||
|
||||
exe = fu(list, set, 3, '', d='')
|
||||
|
||||
#? str()
|
||||
exe[3][0]
|
||||
|
||||
# -----------------
|
||||
# generators
|
||||
# -----------------
|
||||
|
||||
Reference in New Issue
Block a user