forked from VimPlug/jedi
add property tests for renaming and removed some limitations of renaming, fixes davidhalter/jedi-vim#57
This commit is contained in:
@@ -383,19 +383,6 @@ def related_names(definitions, search_name, mods):
|
||||
if not definitions:
|
||||
return set()
|
||||
|
||||
def is_definition(arr):
|
||||
try:
|
||||
for a in arr:
|
||||
assert len(a) == 1
|
||||
a = a[0]
|
||||
if a.isinstance(parsing.Array):
|
||||
assert is_definition(a)
|
||||
elif a.isinstance(parsing.Call):
|
||||
assert a.execution is None
|
||||
return True
|
||||
except AssertionError:
|
||||
return False
|
||||
|
||||
compare_definitions = compare_array(definitions)
|
||||
mods |= set([d.get_parent_until() for d in definitions])
|
||||
names = []
|
||||
@@ -423,7 +410,6 @@ def related_names(definitions, search_name, mods):
|
||||
else:
|
||||
calls = _scan_array(stmt.get_assignment_calls(), search_name)
|
||||
for d in stmt.assignment_details:
|
||||
if not is_definition(d[1]):
|
||||
calls += _scan_array(d[1], search_name)
|
||||
for call in calls:
|
||||
names += check_call(call)
|
||||
|
||||
@@ -142,7 +142,7 @@ class Super(object):
|
||||
def base_method(self):
|
||||
#< 13 (0,13), (20,13)
|
||||
self.base_var = 1
|
||||
#< 13 (0,13), (29,13)
|
||||
#< 13 (0,13), (24,13), (29,13)
|
||||
self.instance_var = 1
|
||||
|
||||
#< 8 (0,8),
|
||||
@@ -173,3 +173,33 @@ class TestClass(Super):
|
||||
def just_a_method(self):
|
||||
#< (-5,13), (0,13), (-29,13)
|
||||
self.instance_var
|
||||
|
||||
|
||||
# -----------------
|
||||
# properties
|
||||
# -----------------
|
||||
class TestProperty:
|
||||
|
||||
@property
|
||||
#< 10 (0,8), (5,13)
|
||||
def prop(self):
|
||||
return 1
|
||||
|
||||
def a(self):
|
||||
#< 13 (-5,8), (0,13)
|
||||
self.prop
|
||||
|
||||
@property
|
||||
#< 13 (0,8), (4,5)
|
||||
def rw_prop(self):
|
||||
return self._rw_prop
|
||||
|
||||
#< 8 (-4,8), (0,5)
|
||||
@rw_prop.setter
|
||||
#< 8 (0,8), (5,13)
|
||||
def rw_prop(self, value):
|
||||
self._rw_prop = value
|
||||
|
||||
def b(self):
|
||||
#< 13 (-5,8), (0,13)
|
||||
self.rw_prop
|
||||
|
||||
Reference in New Issue
Block a user