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

Function test_macro

tests/test_magic.py:290–300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

288
289
290def test_macro():
291 ip = get_ipython()
292 ip.history_manager.reset() # Clear any existing history.
293 cmds = ["a=1", "def b():\n return a**2", "print(a,b())"]
294 for i, cmd in enumerate(cmds, start=1):
295 ip.history_manager.store_inputs(i, cmd)
296 ip.run_line_magic("macro", "test 1-3")
297 assert ip.user_ns["test"].value == "\n".join(cmds) + "\n"
298
299 # List macros
300 assert "test" in ip.run_line_magic("macro", "")
301
302
303def test_macro_run():

Callers

nothing calls this directly

Calls 4

get_ipythonFunction · 0.90
store_inputsMethod · 0.80
run_line_magicMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…