MCPcopy Create free account
hub / github.com/ipython/ipython / test_jedi

Method test_jedi

IPython/core/tests/test_completer.py:388–421  ·  view source on GitHub ↗

A couple of issue we had with Jedi

(self)

Source from the content-addressed store, hash-verified

386 assert matches == ['TestClass.a', 'TestClass.a1'], jedi_status
387
388 def test_jedi(self):
389 """
390 A couple of issue we had with Jedi
391 """
392 ip = get_ipython()
393
394 def _test_complete(reason, s, comp, start=None, end=None):
395 l = len(s)
396 start = start if start is not None else l
397 end = end if end is not None else l
398 with provisionalcompleter():
399 ip.Completer.use_jedi = True
400 completions = set(ip.Completer.completions(s, l))
401 ip.Completer.use_jedi = False
402 assert_in(Completion(start, end, comp), completions, reason)
403
404 def _test_not_complete(reason, s, comp):
405 l = len(s)
406 with provisionalcompleter():
407 ip.Completer.use_jedi = True
408 completions = set(ip.Completer.completions(s, l))
409 ip.Completer.use_jedi = False
410 assert_not_in(Completion(l, l, comp), completions, reason)
411
412 import jedi
413
414 jedi_version = tuple(int(i) for i in jedi.__version__.split(".")[:3])
415 if jedi_version > (0, 10):
416 yield _test_complete, "jedi >0.9 should complete and not crash", "a=1;a.", "real"
417 yield _test_complete, "can infer first argument", 'a=(1,"foo");a[0].', "real"
418 yield _test_complete, "can infer second argument", 'a=(1,"foo");a[1].', "capitalize"
419 yield _test_complete, "cover duplicate completions", "im", "import", 0, 2
420
421 yield _test_not_complete, "does not mix types", 'a=(1,"foo");a[0].', "capitalize"
422
423 def test_completion_have_signature(self):
424 """

Callers

nothing calls this directly

Calls 1

get_ipythonFunction · 0.90

Tested by

no test coverage detected