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

Method test_line_cell_magics

IPython/core/tests/test_completer.py:644–666  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

642 nt.assert_in("%%_foo_cellm", matches)
643
644 def test_line_cell_magics(self):
645 from IPython.core.magic import register_line_cell_magic
646
647 @register_line_cell_magic
648 def _bar_cellm(line, cell):
649 pass
650
651 ip = get_ipython()
652 c = ip.Completer
653
654 # The policy here is trickier, see comments in completion code. The
655 # returned values depend on whether the user passes %% or not explicitly,
656 # and this will show a difference if the same name is both a line and cell
657 # magic.
658 s, matches = c.complete(None, "_bar_ce")
659 nt.assert_in("%_bar_cellm", matches)
660 nt.assert_in("%%_bar_cellm", matches)
661 s, matches = c.complete(None, "%_bar_ce")
662 nt.assert_in("%_bar_cellm", matches)
663 nt.assert_in("%%_bar_cellm", matches)
664 s, matches = c.complete(None, "%%_bar_ce")
665 nt.assert_not_in("%_bar_cellm", matches)
666 nt.assert_in("%%_bar_cellm", matches)
667
668 def test_magic_completion_order(self):
669 ip = get_ipython()

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
completeMethod · 0.45

Tested by

no test coverage detected