sorted output for get_definition / goto

This commit is contained in:
David Halter
2012-09-10 14:07:54 +02:00
parent a4a8c8f343
commit 440eae7c15
2 changed files with 4 additions and 4 deletions

View File

@@ -238,7 +238,7 @@ def get_definition(source, line, column, source_path):
d = set([Definition(s) for s in scopes])
_clear_caches()
return d
return sorted(d, key=lambda x: (x.module_path, x.start_pos))
def goto(source, line, column, source_path):
@@ -264,7 +264,7 @@ def goto(source, line, column, source_path):
d = [Definition(d) for d in set(definitions)]
_clear_caches()
return d
return sorted(d, key=lambda x: (x.module_path, x.start_pos))
def related_names(source, line, column, source_path):

View File

@@ -69,11 +69,11 @@ class TestRegression(unittest.TestCase):
assert len(r[0].doc) > 100
def test_get_definition_at_zero(self):
assert self.get_def("a", (1, 1)) == set()
assert self.get_def("a", (1, 1)) == []
s = self.get_def("str", (1, 1))
assert len(s) == 1
assert list(s)[0].description == 'class str'
assert self.get_def("", (1, 0)) == set()
assert self.get_def("", (1, 0)) == []
def test_complete_at_zero(self):
s = self.complete("str", (1, 3))