forked from VimPlug/jedi
class decorators with __call__ are now properly working
This commit is contained in:
@@ -183,9 +183,27 @@ class B():
|
||||
def r(self):
|
||||
return 1
|
||||
|
||||
@r.setter
|
||||
def r(self, value):
|
||||
pass
|
||||
#@r.setter
|
||||
#def r(self, value):
|
||||
# pass
|
||||
|
||||
#? []
|
||||
B().r.
|
||||
#? []
|
||||
B().r()
|
||||
|
||||
class Decorator(object):
|
||||
def __init__(self, func):
|
||||
self.func = func
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.func(1, *args, **kwargs)
|
||||
|
||||
@Decorator
|
||||
def nothing(a,b,c):
|
||||
return a,b,c
|
||||
|
||||
#? int()
|
||||
nothing("")[0]
|
||||
#? str()
|
||||
nothing("")[1]
|
||||
|
||||
@@ -54,12 +54,15 @@ def run_definition_test(correct, source, line_nr, line):
|
||||
else:
|
||||
should_be = set()
|
||||
for index in re.finditer('(?: +|$)', correct):
|
||||
if correct == ' ':
|
||||
continue
|
||||
# -1 for the comment, +3 because of the comment start `#? `
|
||||
start = index.start() + 3
|
||||
try:
|
||||
should_be |= defs(line_nr-1, start)
|
||||
except Exception:
|
||||
print 'could not resolve %s indent %' % (line_nr - 1, start)
|
||||
print 'could not resolve %s indent %s' % (line_nr - 1, start)
|
||||
return 1
|
||||
# because the objects have different ids, `repr` it, then compare it.
|
||||
should_str = sorted(str(r) for r in should_be)
|
||||
is_str = sorted(str(r) for r in result)
|
||||
|
||||
Reference in New Issue
Block a user