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