def test_magic_completion_shadowing():
ip = get_ipython()
c = ip.Completer
# Before importing matplotlib, %matplotlib magic should be the only option.
text, matches = c.complete("mat")
nt.assert_equal(matches, ["%matplotlib"])
# The newly introduced name should shadow the magic.
ip.run_cell("matplotlib = 1")
text, matches = c.complete("mat")
nt.assert_equal(matches, ["matplotlib"])
# After removing matplotlib from namespace, the magic should again be
# the only option.
del ip.user_ns["matplotlib"]
text, matches = c.complete("mat")
nt.assert_equal(matches, ["%matplotlib"])
评论列表
文章目录