Skip to content

Commit

Permalink
Add test for magic macro command.
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Feb 9, 2011
1 parent 601d156 commit e72b879
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions IPython/core/tests/test_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ def test_shist():
yield nt.assert_equal,s.get(2),'world'

shutil.rmtree(tfile)

def test_macro():
ip = get_ipython()
ip.history_manager.reset() # Clear any existing history.
cmds = ["a=1", "def b():\n return a**2", "print(a,b())"]
for cmd in cmds:
ip.history_manager.store_inputs(cmd)
ip.magic("macro test 1-3")
nt.assert_equal(ip.user_ns["test"].value, "\n".join(cmds)+"\n")

# List macros. This goes to stdout, so just check it doesn't crash.
ip.magic("macro")


# XXX failing for now, until we get clearcmd out of quarantine. But we should
Expand Down

0 comments on commit e72b879

Please sign in to comment.