Permalink
Browse files

Add test for magic macro command.

  • Loading branch information...
1 parent 601d156 commit e72b879d3fb1498c136f7921ec20f1ae6e218ae0 @takluyver committed Feb 9, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 IPython/core/tests/test_magic.py
@@ -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

0 comments on commit e72b879

Please sign in to comment.