diff --git a/IPython/core/alias.py b/IPython/core/alias.py index 3d79908..903e2d7 100644 --- a/IPython/core/alias.py +++ b/IPython/core/alias.py @@ -169,6 +169,10 @@ class Alias(object): if cmd.find('%l') >= 0: cmd = cmd.replace('%l', rest) rest = '' + + if cmd.find('%%s') >= 1: + cmd = cmd.replace('%%s', '%s') + if nargs==0: # Simple, argument-less aliases cmd = '%s %s' % (cmd, rest) diff --git a/IPython/core/tests/test_alias.py b/IPython/core/tests/test_alias.py index 63479ae..cba7a34 100644 --- a/IPython/core/tests/test_alias.py +++ b/IPython/core/tests/test_alias.py @@ -42,9 +42,9 @@ def test_alias_args_error(): def test_alias_args_commented(): """Check that alias correctly ignores 'commented out' args""" - _ip.alias_manager.define_alias('commetarg', 'echo this is %%s a "commented out" arg') + _ip.magic('alias commetarg echo this is %%s a "commented out" arg') - with capture_output as cap: + with capture_output() as cap: _ip.run_cell('commetarg') nt.assert_equal(cap.stdout, 'this is %s a "commented out" arg') \ No newline at end of file