Test %alias_magic.
()
| 1052 | nt.assert_true(mm.magics['line']['foo'].__self__ is foo2) |
| 1053 | |
| 1054 | def test_alias_magic(): |
| 1055 | """Test %alias_magic.""" |
| 1056 | ip = get_ipython() |
| 1057 | mm = ip.magics_manager |
| 1058 | |
| 1059 | # Basic operation: both cell and line magics are created, if possible. |
| 1060 | ip.run_line_magic('alias_magic', 'timeit_alias timeit') |
| 1061 | nt.assert_in('timeit_alias', mm.magics['line']) |
| 1062 | nt.assert_in('timeit_alias', mm.magics['cell']) |
| 1063 | |
| 1064 | # --cell is specified, line magic not created. |
| 1065 | ip.run_line_magic('alias_magic', '--cell timeit_cell_alias timeit') |
| 1066 | nt.assert_not_in('timeit_cell_alias', mm.magics['line']) |
| 1067 | nt.assert_in('timeit_cell_alias', mm.magics['cell']) |
| 1068 | |
| 1069 | # Test that line alias is created successfully. |
| 1070 | ip.run_line_magic('alias_magic', '--line env_alias env') |
| 1071 | nt.assert_equal(ip.run_line_magic('env', ''), |
| 1072 | ip.run_line_magic('env_alias', '')) |
| 1073 | |
| 1074 | # Test that line alias with parameters passed in is created successfully. |
| 1075 | ip.run_line_magic('alias_magic', '--line history_alias history --params ' + shlex.quote('3')) |
| 1076 | nt.assert_in('history_alias', mm.magics['line']) |
| 1077 | |
| 1078 | |
| 1079 | def test_save(): |
nothing calls this directly
no test coverage detected