From f0c2b9e813ad0e465f9255d069d2ccc74fb2e5d7 2012-05-28 08:28:15 From: MinRK Date: 2012-05-28 08:28:15 Subject: [PATCH] test Magic.parse_options with long options --- diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 803b343..fb25f23 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -541,7 +541,7 @@ class Magics(object): argv = arg_split(arg_str, posix, strict) # Do regular option processing try: - opts,args = getopt(argv,opt_str,*long_opts) + opts,args = getopt(argv, opt_str, long_opts) except GetoptError,e: raise UsageError('%s ( allowed: "%s" %s)' % (e.msg,opt_str, " ".join(long_opts))) diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index 296d895..b6572dc 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -69,6 +69,15 @@ def test_magic_parse_options(): expected = path nt.assert_equals(opts['f'], expected) +def test_magic_parse_long_options(): + """Magic.parse_options can handle --foo=bar long options""" + ip = get_ipython() + m = DummyMagics(ip) + opts, _ = m.parse_options('--foo --bar=bubble', 'a', 'foo', 'bar=') + nt.assert_true('foo' in opts) + nt.assert_true('bar' in opts) + nt.assert_true(opts['bar'], "bubble") + @dec.skip_without('sqlite3') def doctest_hist_f():