forked from VimPlug/jedi
many new renaming tests (and bug fixes)
This commit is contained in:
@@ -349,6 +349,14 @@ class ArrayInstance(parsing.Base):
|
||||
|
||||
|
||||
def related_names(definitions, search_name, mods):
|
||||
def strip_ambiguity(definitions):
|
||||
result = []
|
||||
for d in definitions:
|
||||
if isinstance(d, evaluate.InstanceElement):
|
||||
d = d.var
|
||||
result.append(d)
|
||||
return result
|
||||
|
||||
def check_call(call):
|
||||
result = []
|
||||
follow = [] # There might be multiple search_name's in one call_path
|
||||
@@ -361,6 +369,7 @@ def related_names(definitions, search_name, mods):
|
||||
for f in follow:
|
||||
follow_res, search = evaluate.goto(call.parent_stmt, f)
|
||||
follow_res = related_name_add_import_modules(follow_res, search)
|
||||
follow_res = strip_ambiguity(follow_res)
|
||||
|
||||
#print follow_res, [d.parent for d in follow_res]
|
||||
# compare to see if they match
|
||||
@@ -386,6 +395,7 @@ def related_names(definitions, search_name, mods):
|
||||
except AssertionError:
|
||||
return False
|
||||
|
||||
definitions = strip_ambiguity(definitions)
|
||||
mods |= set([d.get_parent_until() for d in definitions])
|
||||
names = []
|
||||
for m in get_directory_modules_for_name(mods, search_name):
|
||||
|
||||
@@ -49,6 +49,18 @@ def blub():
|
||||
def a(): pass
|
||||
|
||||
|
||||
response = 5
|
||||
#< 0 (0,0), (1,0), (2,0), (4,0)
|
||||
response = HttpResponse(mimetype='application/pdf')
|
||||
response['Content-Disposition'] = 'attachment; filename=%s.pdf' % id
|
||||
response.write(pdf)
|
||||
#< (-4,0), (-3,0), (-2,0), (0,0)
|
||||
response
|
||||
|
||||
|
||||
# -----------------
|
||||
# imports
|
||||
# -----------------
|
||||
#< (0,7), (3,0)
|
||||
import module_not_exists
|
||||
|
||||
@@ -73,24 +85,31 @@ from import_tree.rename1 import abc
|
||||
from import_tree.rename1 import not_existing
|
||||
|
||||
|
||||
response = 5
|
||||
#< 0 (0,0), (1,0), (2,0), (4,0)
|
||||
response = HttpResponse(mimetype='application/pdf')
|
||||
response['Content-Disposition'] = 'attachment; filename=%s.pdf' % id
|
||||
response.write(pdf)
|
||||
#< (-4,0), (-3,0), (-2,0), (0,0)
|
||||
response
|
||||
# -----------------
|
||||
# classes
|
||||
# -----------------
|
||||
|
||||
class TestMethods(object):
|
||||
#< 8 (0,8), (2,13)
|
||||
def a_method(self):
|
||||
#< 13 (-2,8), (0,13)
|
||||
self.a_method()
|
||||
#< 13 (2,8), (0,13), (3,13)
|
||||
self.b_method()
|
||||
|
||||
def b_method(self):
|
||||
self.b_method
|
||||
|
||||
|
||||
class Super(object):
|
||||
base_class = 1
|
||||
def base_method(self):
|
||||
self.base_var
|
||||
|
||||
#< 20 (0,16), (-6,6)
|
||||
class TestClass(Super):
|
||||
class TestClassVar(object):
|
||||
#< 4 (0,4), (5,13), (7,21)
|
||||
class_v = 1
|
||||
def a(self):
|
||||
pass
|
||||
class_v = 1
|
||||
|
||||
def b(self):
|
||||
pass
|
||||
#< (-5,4), (0,13), (2,21)
|
||||
self.class_v
|
||||
#< (-7,4), (-2,13), (0,21)
|
||||
TestClassVar.class_v
|
||||
#< (0,8), (-7, 8)
|
||||
class_v
|
||||
|
||||
Reference in New Issue
Block a user