From 3d0defaa34930d66ee1376a61aef50e5fd46896e 2015-03-26 15:48:09 From: Thomas Adriaan Hellinger Date: 2015-03-26 15:48:09 Subject: [PATCH] Fixed bug in alias; wrote new alias test. --- 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