##// END OF EJS Templates
Add some tests for assignment from system/magic commands
Thomas Kluyver -
Show More
@@ -41,20 +41,29 b' syntax = \\'
41 41 [(i,py3compat.u_format(o)) for i,o in \
42 42 [(u'a =! ls', "a = get_ipython().getoutput({u}'ls')"),
43 43 (u'b = !ls', "b = get_ipython().getoutput({u}'ls')"),
44 (u'c= !ls', "c = get_ipython().getoutput({u}'ls')"),
45 (u'd == !ls', u'd == !ls'), # Invalid syntax, but we leave == alone.
44 46 ('x=1', 'x=1'), # normal input is unmodified
45 47 (' ',' '), # blank lines are kept intact
46 48 # Tuple unpacking
47 49 (u"a, b = !echo 'a\\nb'", u"a, b = get_ipython().getoutput({u}\"echo 'a\\\\nb'\")"),
48 50 (u"a,= !echo 'a'", u"a, = get_ipython().getoutput({u}\"echo 'a'\")"),
49 51 (u"a, *bc = !echo 'a\\nb\\nc'", u"a, *bc = get_ipython().getoutput({u}\"echo 'a\\\\nb\\\\nc'\")"),
52 # Tuple unpacking with regular Python expressions, not our syntax.
53 (u"a, b = range(2)", u"a, b = range(2)"),
54 (u"a, = range(1)", u"a, = range(1)"),
55 (u"a, *bc = range(3)", u"a, *bc = range(3)"),
50 56 ]],
51 57
52 58 assign_magic =
53 59 [(i,py3compat.u_format(o)) for i,o in \
54 60 [(u'a =% who', "a = get_ipython().magic({u}'who')"),
55 61 (u'b = %who', "b = get_ipython().magic({u}'who')"),
62 (u'c= %ls', "c = get_ipython().magic({u}'ls')"),
63 (u'd == %ls', u'd == %ls'), # Invalid syntax, but we leave == alone.
56 64 ('x=1', 'x=1'), # normal input is unmodified
57 65 (' ',' '), # blank lines are kept intact
66 (u"a, b = %foo", u"a, b = get_ipython().magic({u}'foo')"),
58 67 ]],
59 68
60 69 classic_prompt =
General Comments 0
You need to be logged in to leave comments. Login now