##// END OF EJS Templates
BUG: multi-line, multi-block cells were broken. Test added....
Fernando Perez -
Show More
@@ -2094,7 +2094,6 b' class InteractiveShell(Configurable, Magic):'
2094 # Store the untransformed code
2094 # Store the untransformed code
2095 raw_cell = cell
2095 raw_cell = cell
2096
2096
2097
2098 # Code transformation and execution must take place with our
2097 # Code transformation and execution must take place with our
2099 # modifications to builtins.
2098 # modifications to builtins.
2100 with self.builtin_trap:
2099 with self.builtin_trap:
@@ -2128,7 +2127,6 b' class InteractiveShell(Configurable, Magic):'
2128 # All user code execution should take place with our
2127 # All user code execution should take place with our
2129 # modified displayhook.
2128 # modified displayhook.
2130 with self.display_trap:
2129 with self.display_trap:
2131
2132 # Single-block input should behave like an interactive prompt
2130 # Single-block input should behave like an interactive prompt
2133 if len(blocks) == 1:
2131 if len(blocks) == 1:
2134 out = self.run_source(blocks[0])
2132 out = self.run_source(blocks[0])
@@ -2164,7 +2162,7 b' class InteractiveShell(Configurable, Magic):'
2164 else:
2162 else:
2165 # Run the whole cell as one entity, storing both raw and
2163 # Run the whole cell as one entity, storing both raw and
2166 # processed input in history
2164 # processed input in history
2167 self.run_source(ipy_cell, symbol='exec')
2165 self.run_source(cell, symbol='exec')
2168
2166
2169 # Write output to the database. Does nothing unless
2167 # Write output to the database. Does nothing unless
2170 # history output logging is enabled.
2168 # history output logging is enabled.
@@ -41,3 +41,17 b' class InteractiveShellTestCase(unittest.TestCase):'
41 cell of input. Yes, I did overlook that."""
41 cell of input. Yes, I did overlook that."""
42 ip = get_ipython()
42 ip = get_ipython()
43 ip.run_cell('')
43 ip.run_cell('')
44
45 def test_run_cell_multilne(self):
46 """Multi-block, multi-line cells must execute correctly.
47 """
48 ip = get_ipython()
49 src = '\n'.join(["x=1",
50 "y=2",
51 "if 1:",
52 " x += 1",
53 " y += 1",])
54 ip.run_cell(src)
55 self.assertEquals(ip.user_ns['x'], 2)
56 self.assertEquals(ip.user_ns['y'], 3)
57
General Comments 0
You need to be logged in to leave comments. Login now