##// END OF EJS Templates
Fix all_completions output for both Jedi and non-Jedi cases...
Brandon T. Willard -
Show More
@@ -1139,10 +1139,10 b' class IPCompleter(Completer):'
1139 """
1139 """
1140 Wrapper around the completion methods for the benefit of emacs.
1140 Wrapper around the completion methods for the benefit of emacs.
1141 """
1141 """
1142 prefix = text[:text.rfind(".") + 1]
1142 prefix = text.rpartition('.')[0]
1143 with provisionalcompleter():
1143 with provisionalcompleter():
1144 return list(map(lambda c: prefix + c.text,
1144 return ['.'.join([prefix, c.text]) if prefix and self.use_jedi else c.text
1145 self.completions(text, len(text))))
1145 for c in self.completions(text, len(text))]
1146
1146
1147 return self.complete(text)[1]
1147 return self.complete(text)[1]
1148
1148
@@ -346,6 +346,24 b' class TestCompleter(unittest.TestCase):'
346 )[1]
346 )[1]
347 nt.assert_equal(c, [escaped])
347 nt.assert_equal(c, [escaped])
348
348
349 def test_all_completions_dups(self):
350 """
351 Make sure the output of `IPCompleter.all_completions` does not have
352 duplicated prefixes.
353 """
354 ip = get_ipython()
355 c = ip.Completer
356 ip.ex("class TestClass():\n\ta=1\n\ta1=2")
357 for jedi_status in [True, False]:
358 with provisionalcompleter():
359 ip.Completer.use_jedi = jedi_status
360 matches = c.all_completions("TestCl")
361 assert matches == ['TestClass'], jedi_status
362 matches = c.all_completions("TestClass.")
363 assert len(matches) > 2, jedi_status
364 matches = c.all_completions("TestClass.a")
365 assert matches == ['TestClass.a', 'TestClass.a1'], jedi_status
366
349 def test_jedi(self):
367 def test_jedi(self):
350 """
368 """
351 A couple of issue we had with Jedi
369 A couple of issue we had with Jedi
General Comments 0
You need to be logged in to leave comments. Login now