From 7088edfbb63ed0e19fa0c7ea42d61af9b53d8b58 2014-03-10 22:13:05 From: Thomas Kluyver Date: 2014-03-10 22:13:05 Subject: [PATCH] Add some tests for assignment from system/magic commands --- diff --git a/IPython/core/tests/test_inputtransformer.py b/IPython/core/tests/test_inputtransformer.py index 4261cbf..b3295b6 100644 --- a/IPython/core/tests/test_inputtransformer.py +++ b/IPython/core/tests/test_inputtransformer.py @@ -41,20 +41,29 @@ syntax = \ [(i,py3compat.u_format(o)) for i,o in \ [(u'a =! ls', "a = get_ipython().getoutput({u}'ls')"), (u'b = !ls', "b = get_ipython().getoutput({u}'ls')"), + (u'c= !ls', "c = get_ipython().getoutput({u}'ls')"), + (u'd == !ls', u'd == !ls'), # Invalid syntax, but we leave == alone. ('x=1', 'x=1'), # normal input is unmodified (' ',' '), # blank lines are kept intact # Tuple unpacking (u"a, b = !echo 'a\\nb'", u"a, b = get_ipython().getoutput({u}\"echo 'a\\\\nb'\")"), (u"a,= !echo 'a'", u"a, = get_ipython().getoutput({u}\"echo 'a'\")"), (u"a, *bc = !echo 'a\\nb\\nc'", u"a, *bc = get_ipython().getoutput({u}\"echo 'a\\\\nb\\\\nc'\")"), + # Tuple unpacking with regular Python expressions, not our syntax. + (u"a, b = range(2)", u"a, b = range(2)"), + (u"a, = range(1)", u"a, = range(1)"), + (u"a, *bc = range(3)", u"a, *bc = range(3)"), ]], assign_magic = [(i,py3compat.u_format(o)) for i,o in \ [(u'a =% who', "a = get_ipython().magic({u}'who')"), (u'b = %who', "b = get_ipython().magic({u}'who')"), + (u'c= %ls', "c = get_ipython().magic({u}'ls')"), + (u'd == %ls', u'd == %ls'), # Invalid syntax, but we leave == alone. ('x=1', 'x=1'), # normal input is unmodified (' ',' '), # blank lines are kept intact + (u"a, b = %foo", u"a, b = get_ipython().magic({u}'foo')"), ]], classic_prompt =