MCPcopy Index your code
hub / github.com/ipython/ipython / test_all_completions_dups

Method test_all_completions_dups

tests/test_completer.py:470–489  ·  view source on GitHub ↗

Make sure the output of `IPCompleter.all_completions` does not have duplicated prefixes.

(self)

Source from the content-addressed store, hash-verified

468 reason="Parso does not yet parse 3.13",
469 )
470 def test_all_completions_dups(self):
471 """
472 Make sure the output of `IPCompleter.all_completions` does not have
473 duplicated prefixes.
474 """
475 ip = get_ipython()
476 c = ip.Completer
477 ip.ex("class TestClass():\n\ta=1\n\ta1=2")
478 for jedi_status in [True, False]:
479 with provisionalcompleter():
480 ip.Completer.use_jedi = jedi_status
481 matches = c.all_completions("TestCl")
482 assert matches == ["TestClass"], (jedi_status, matches)
483 matches = c.all_completions("TestClass.")
484 assert len(matches) > 2, (jedi_status, matches)
485 matches = c.all_completions("TestClass.a")
486 if jedi_status:
487 assert matches == ["TestClass.a", "TestClass.a1"], jedi_status
488 else:
489 assert matches == [".a", ".a1"], jedi_status
490
491 @pytest.mark.xfail(
492 sys.version_info.releaselevel in ("alpha",),

Callers

nothing calls this directly

Calls 4

get_ipythonFunction · 0.90
provisionalcompleterFunction · 0.90
exMethod · 0.80
all_completionsMethod · 0.80

Tested by

no test coverage detected