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

Method test_magic_completion_shadowing

tests/test_completer.py:981–999  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

979 self.assertEqual(matches, ["%timeit", "%%timeit"])
980
981 def test_magic_completion_shadowing(self):
982 ip = get_ipython()
983 c = ip.Completer
984 c.use_jedi = False
985
986 # Before importing matplotlib, %matplotlib magic should be the only option.
987 text, matches = c.complete("mat")
988 self.assertEqual(matches, ["%matplotlib"])
989
990 # The newly introduced name should shadow the magic.
991 ip.run_cell("matplotlib = 1")
992 text, matches = c.complete("mat")
993 self.assertEqual(matches, ["matplotlib"])
994
995 # After removing matplotlib from namespace, the magic should again be
996 # the only option.
997 del ip.user_ns["matplotlib"]
998 text, matches = c.complete("mat")
999 self.assertEqual(matches, ["%matplotlib"])
1000
1001 def test_magic_completion_shadowing_explicit(self):
1002 """

Callers

nothing calls this directly

Calls 3

get_ipythonFunction · 0.90
completeMethod · 0.45
run_cellMethod · 0.45

Tested by

no test coverage detected