mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
changed rename tests
This commit is contained in:
@@ -334,7 +334,7 @@ class Script(object):
|
||||
module.add(self.parser.module)
|
||||
names = dynamic.related_names(definitions, search_name, module)
|
||||
|
||||
for d in definitions:
|
||||
for d in set(definitions):
|
||||
if isinstance(d, parsing.Module):
|
||||
names.append(dynamic.RelatedName(d, d))
|
||||
else:
|
||||
|
||||
@@ -3,10 +3,10 @@ Renaming tests. This means search for related names.
|
||||
I always leave a little bit of space to add room for additions, because the
|
||||
results always contain position informations.
|
||||
"""
|
||||
#< 4 (7,4) (10,0) (12,0)
|
||||
#< 4 (7,4), (10,0), (12,0)
|
||||
def abc(): pass
|
||||
|
||||
#< 0 (7,4) (10,0) (12,0)
|
||||
#< 0 (7,4), (10,0), (12,0)
|
||||
abc.d.a.bsaasd.abc.d
|
||||
|
||||
abc
|
||||
@@ -19,29 +19,29 @@ abc
|
||||
|
||||
abc =
|
||||
|
||||
#< (20,0) (23,0)
|
||||
#< (20,0), (23,0)
|
||||
abc
|
||||
|
||||
|
||||
|
||||
Abc = 3
|
||||
|
||||
#< 6 (30,6) (32,4) (35,8) (47,0)
|
||||
#< 6 (30,6), (32,4), (35,8), (47,0)
|
||||
class Abc():
|
||||
#< (30,6) (32,4) (35,8) (47,0)
|
||||
#< (30,6), (32,4), (35,8), (47,0)
|
||||
Abc
|
||||
|
||||
def Abc(self):
|
||||
Abc; self.c = 3
|
||||
|
||||
#< 17 (38,16) (40,8)
|
||||
#< 17 (38,16), (40,8)
|
||||
def a(self, Abc):
|
||||
#< 10 (38,16) (40,8)
|
||||
#< 10 (38,16), (40,8)
|
||||
Abc
|
||||
|
||||
#< 19 (43,18) (45,8)
|
||||
#< 19 (43,18), (45,8)
|
||||
def self_test(self):
|
||||
#< 12 (43,18) (45,8)
|
||||
#< 12 (43,18), (45,8)
|
||||
self.b
|
||||
|
||||
Abc.d.Abc
|
||||
@@ -51,32 +51,35 @@ Abc.d.Abc
|
||||
|
||||
|
||||
|
||||
#< 4 (55,4) (59,1)
|
||||
#< 4 (55,4), (59,1)
|
||||
def blub():
|
||||
|
||||
|
||||
#< (55,4) (59,1)
|
||||
#< (55,4), (59,1)
|
||||
@blub
|
||||
def a(): pass
|
||||
|
||||
|
||||
|
||||
#< (65,7) (68,0)
|
||||
#< (65,7), (68,0)
|
||||
import module_not_exists
|
||||
|
||||
#< (65,7) (68,0)
|
||||
#< (65,7), (68,0)
|
||||
module_not_exists
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#< (85,17), (75,24), (78,0), (81,17), (4,5)
|
||||
from import_tree import rename1
|
||||
|
||||
#< (78,8) (3,0) (4,20) (6,0) (81,32) (82,0) (6,0)
|
||||
#< (78,8), (3,0), (4,20), (6,0), (81,32), (82,0), (6,0)
|
||||
rename1.abc
|
||||
|
||||
#< (78,8) (3,0) (4,20) (6,0) (81,32) (82,0) (6,0)
|
||||
#< (78,8), (3,0), (4,20), (6,0), (81,32), (82,0)
|
||||
from import_tree.rename1 import abc
|
||||
abc
|
||||
|
||||
#< (75, 24),
|
||||
from import_tree.rename1 import not_existing
|
||||
|
||||
@@ -84,9 +84,9 @@ def run_related_name_test(script, correct, line_nr):
|
||||
"""
|
||||
result = script.related_names()
|
||||
correct = correct.strip()
|
||||
comp_str = set('(%s,%s)' % r.start_pos for r in result)
|
||||
correct = set(correct.split(' ')) if correct else set()
|
||||
if comp_str != correct:
|
||||
comp_str = sorted(r.start_pos for r in result)
|
||||
correct = sorted(literal_eval(correct))
|
||||
if sorted(comp_str) != sorted(correct):
|
||||
print('Solution @%s not right, received %s, wanted %s'\
|
||||
% (line_nr - 1, comp_str, correct))
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user