##// END OF EJS Templates
Add tests for %alias_magic.
Bradley M. Froehle -
Show More
@@ -722,3 +722,22 b' def test_multiple_magics():'
722 mm.register(foo2)
722 mm.register(foo2)
723 nt.assert_true(mm.magics['line']['foo'].im_self is foo2)
723 nt.assert_true(mm.magics['line']['foo'].im_self is foo2)
724
724
725 def test_alias_magic():
726 """Test %alias_magic."""
727 ip = get_ipython()
728 mm = ip.magics_manager
729
730 # Basic operation: both cell and line magics are created, if possible.
731 ip.run_line_magic('alias_magic', 'timeit_alias timeit')
732 nt.assert_true('timeit_alias' in mm.magics['line'])
733 nt.assert_true('timeit_alias' in mm.magics['cell'])
734
735 # --cell is specified, line magic not created.
736 ip.run_line_magic('alias_magic', '--cell timeit_cell_alias timeit')
737 nt.assert_false('timeit_cell_alias' in mm.magics['line'])
738 nt.assert_true('timeit_cell_alias' in mm.magics['cell'])
739
740 # Test that line alias is created successfully.
741 ip.run_line_magic('alias_magic', '--line env_alias env')
742 nt.assert_equal(ip.run_line_magic('env', ''),
743 ip.run_line_magic('env_alias', ''))
General Comments 0
You need to be logged in to leave comments. Login now